Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
254b31adb2 | ||
|
|
6da6c0b3f8 |
-28
@@ -1,28 +0,0 @@
|
||||
# CVS default ignores begin
|
||||
tags
|
||||
TAGS
|
||||
.make.state
|
||||
.nse_depinfo
|
||||
*~
|
||||
\#*
|
||||
.#*
|
||||
,*
|
||||
_$*
|
||||
*$
|
||||
*.old
|
||||
*.bak
|
||||
*.BAK
|
||||
*.orig
|
||||
*.rej
|
||||
.del-*
|
||||
*.a
|
||||
*.olb
|
||||
*.o
|
||||
*.obj
|
||||
*.so
|
||||
*.exe
|
||||
*.Z
|
||||
*.elc
|
||||
*.ln
|
||||
core
|
||||
# CVS default ignores end
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Top level Cakefile.
|
||||
*
|
||||
* This Cakefile serves the same purpose as the top level Makefile,
|
||||
* ie, to run the "gen.sh" script with the given argument.
|
||||
*
|
||||
* $Header$
|
||||
*/
|
||||
|
||||
%&:
|
||||
/bin/sh gen.sh %
|
||||
|
||||
all&::
|
||||
/bin/sh gen.sh
|
||||
-946
@@ -1,946 +0,0 @@
|
||||
/*
|
||||
* C A K E F I L E . D E F S
|
||||
*
|
||||
* Main include file for compiling the BRL CAD Package with the CAKE program.
|
||||
*
|
||||
* Author -
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
* For those unfamiliar with CAKE, one important hint:
|
||||
* When a rule includes an ampersand ('&') before the colon,
|
||||
* this signals a pattern that does not result in a file being
|
||||
* created. If the ampersand is absent, CAKE checks to make sure
|
||||
* that the target (file) was created.
|
||||
*
|
||||
* Note that CAKE ordinarily runs shell commands through CSH,
|
||||
* but these Cakefiles insist on using the Bourne Shell instead,
|
||||
* so an override is enforced, below, with the "set" command.
|
||||
*
|
||||
* WARNING: Do NOT add comments after defining a parameter,
|
||||
* instead, place all comments on a line by themselves!
|
||||
* While the comment itself is removed, the trailing tabs
|
||||
* will remain. Having unexpected white space at the end of
|
||||
* most definitions will generally ruin the expansion, later.
|
||||
*
|
||||
* WARNING: For proper operation on the SGI 3-D machines,
|
||||
* all comments must start in the first column, or CPP will
|
||||
* leave the leading tabs in place, and confuse Cake.
|
||||
*
|
||||
* UNIXTYPE: By default, a machine is considered to be SYSV,
|
||||
* unless the symbol "BSD" is defined.
|
||||
* BSD=42 For 4.2 BSD
|
||||
* BSD=43 For 4.3 BSD
|
||||
*/
|
||||
#ifndef DEFINES_ONLY
|
||||
set -S1 "/bin/sh -c"
|
||||
set -S2 "/bin/sh"
|
||||
#endif
|
||||
|
||||
/* Program to run to obtain the "sub" substitution effect */
|
||||
#define SUB cakesub
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* If the symbol NFS is not defined, then the normal *
|
||||
* single-machine behavior is implemented. *
|
||||
* In this mode, the object modules are placed into the *
|
||||
* same directory as the source code. *
|
||||
* *
|
||||
* If the symbol NFS is defined, then the NFS-based *
|
||||
* multi-machine behavior is implemented. *
|
||||
* In this mode, a separate directory is made for each *
|
||||
* source directory for each type of client machine. *
|
||||
* This way, the binaries for each type of client machine *
|
||||
* can not co-mingle, yet everything is generated from *
|
||||
* a common set of source code. *
|
||||
* This is the strategy used to handle the machines at BRL. *
|
||||
* For example, the sources in cad/librt/ would have *
|
||||
* sun3 binaries in cad/.librt.sun3/ and *
|
||||
* SGI 4-D binaries in cad/.librt.4d/ *
|
||||
* This requires slightly more care to be certain that you *
|
||||
* are in the right directory before running "cake", but *
|
||||
* being able to share one set of sources across many *
|
||||
* different kinds of machines makes this well worthwhile. *
|
||||
* If you only have one kind of machine, don't bother. *
|
||||
* *
|
||||
****************************************************************/
|
||||
#undef NFS
|
||||
#define NFS 1
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* BEGIN System-specific definitions *
|
||||
* *
|
||||
* Note a moderately ugly problem: the desired value for *
|
||||
* symbol MTYPE is often the same symbol built into CPP *
|
||||
* to indicate the type of machine. Therefore, in order to *
|
||||
* keep the MTYPE string from being converted to *
|
||||
* the string "1", the machine type symbol (eg, "vax") *
|
||||
* must be #undef'ed. *
|
||||
* *
|
||||
* Critical Definitions. These symbols MUST be defined, *
|
||||
* and are not defaulted: *
|
||||
* MTYPE *
|
||||
* HAS_TCP *
|
||||
* LIBRT_TIMER *
|
||||
* *
|
||||
* Optional Definitions. If not defined, defaults are used. *
|
||||
* Some pertain to BRL-CAD software options, *
|
||||
* and some pertain to system-specific compiler options *
|
||||
* CC_DEFS *
|
||||
* CC_OPTS *
|
||||
* LD_OPTS *
|
||||
* LIBFB_CONFIG *
|
||||
* LIBFB_OBJS *
|
||||
* LIBFB_SETUP (default=undefined) *
|
||||
* MGED_CONFIG (default=undefined) *
|
||||
* MGED_OBJS (default=undefined) *
|
||||
* MGED_LIBES (default=undefined) *
|
||||
* RT_CONFIG *
|
||||
* RT_LIBES *
|
||||
* LGT_CONFIG *
|
||||
* RFBD_CONFIG *
|
||||
* CC *
|
||||
* FC *
|
||||
* GETHOST *
|
||||
* RANLIB *
|
||||
* BINDIR, LIBDIR, ETCDIR, INCLUDE_DIR *
|
||||
* ARCH_SUF *
|
||||
* MANDIR *
|
||||
* OPTIMIZER *
|
||||
* PROFILER *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
#ifdef vax
|
||||
/* DEC VAX-11 systems */
|
||||
/* 4.3 BSD "Tahoe" */
|
||||
# undef vax
|
||||
# define MTYPE vax
|
||||
# define BSD 43
|
||||
# define HAS_TCP 1
|
||||
/* On Ultrix & 4.1 systems, #define CC_DEFS -Dvoid=int */
|
||||
# define LIBFB_OBJS if_remote pkg if_ptty if_adage
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_PTTY -DIF_ADAGE
|
||||
/* At USNA, add -DGM256 to LIBFB_CONFIG */
|
||||
# define LIBRT_TIMER timer42
|
||||
# define MGED_OBJS dm-mg dm-vg
|
||||
# define MGED_CONFIG -DDM_MG -DDM_VG
|
||||
# define MGED_LIBES /**/
|
||||
#endif
|
||||
|
||||
#if defined(unix) && defined(m68k)
|
||||
/* Apple MAC II running A/UX 1.0 */
|
||||
# undef aux
|
||||
# define MTYPE aux
|
||||
# define HAS_TCP 0
|
||||
# define LIBRT_TIMER timerunix
|
||||
# define CC_OPTS -ZcI
|
||||
# define LIBPKG_CONFIG -I/usr/include/netinet -DBSD=42
|
||||
# define LIBFB_OBJS if_remote pkg
|
||||
# define LIBFB_CONFIG -DIF_REMOTE
|
||||
# define MGED_OBJS dm-qd filters
|
||||
# define MGED_CONFIG -DDM_QD
|
||||
# define MANDIR /usr/catman/u_man/man
|
||||
#endif
|
||||
|
||||
#ifdef alliant
|
||||
/* Alliant FX/8. Compile all programs for the CEs */
|
||||
# undef fx
|
||||
# undef alliant
|
||||
# define MTYPE fx
|
||||
# define BSD 42
|
||||
# define HAS_TCP 1
|
||||
# if 1
|
||||
/* Standard Alliant C Compiler */
|
||||
# define CC_OPTS -ce
|
||||
# else
|
||||
# if 1
|
||||
/* FX/C, -l option puts listing on stdout. */
|
||||
# define CC /bin/fxc
|
||||
# define CC_OPTS -ce
|
||||
# define OPTIMIZER -Ogiv
|
||||
# else
|
||||
/* GNU C */
|
||||
# define CC gcc
|
||||
# define CC_OPTS -traditional
|
||||
# endif
|
||||
# endif
|
||||
# define LD_OPTS CC_OPTS
|
||||
# define FC /usr/alliant/fortran
|
||||
# define LIBMALLOC /* use vendor library */
|
||||
# define RT_LIBES -lcvec -lcommon
|
||||
# define LIBRT_TIMER timer42
|
||||
#endif
|
||||
|
||||
#ifdef gould
|
||||
/* Gould SEL, PowerNode. Obtain more stack space with -m */
|
||||
/* Tested with UTX/32 2.0 */
|
||||
# undef sel
|
||||
# define MTYPE sel
|
||||
# define BSD 43
|
||||
# define HAS_TCP 1
|
||||
# if 1
|
||||
/* Normal configuration, with optimization */
|
||||
# define LD_OPTS -m 8
|
||||
# else
|
||||
/* DBX configuration, -g, no optimization */
|
||||
# define OPTIMIZER /**/
|
||||
# define CC_OPTS -g
|
||||
# define LD_OPTS -m 8 -g
|
||||
# endif
|
||||
# if 1
|
||||
/* Normal Configuration */
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_PTTY
|
||||
# define LIBFB_OBJS if_remote pkg if_ptty
|
||||
# else
|
||||
/* X-Windows Configuration */
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_PTTY -DIF_X -I/m/X11/core
|
||||
# define LIBFB_OBJS if_remote pkg if_ptty if_X
|
||||
# define LIBFB_SETUP (rm -f PRODUCTS; \
|
||||
cp /usr/local/lib/libX11.a PRODUCTS )
|
||||
# define MGED_OBJS dm-X
|
||||
# define MGED_CONFIG -DDM_X -I/m/X11/core
|
||||
# define MGED_LIBES /usr/local/lib/libX11.a
|
||||
# endif
|
||||
# define LIBRT_TIMER timer42
|
||||
#endif
|
||||
|
||||
#if defined(sgi) && !defined(mips)
|
||||
/* Silicon Graphics 3D */
|
||||
# undef sgi
|
||||
# define MTYPE 3d
|
||||
# define HAS_TCP 1
|
||||
/* set CC_OPTS= -Zf only if Weitek FP chip installed */
|
||||
# define CC_OPTS -Zf
|
||||
# define FC_OPTS CC_OPTS
|
||||
# define LD_OPTS CC_OPTS
|
||||
# define FC /bin/f77
|
||||
# define RANLIB ranlib
|
||||
# define MGED_OBJS dm-ir
|
||||
# define MGED_CONFIG -DDM_IR
|
||||
/* mged_config: append -DMC68010 for non-turbo 2400 */
|
||||
/* mged_config: append -DNOBLOCK for XNS kernels */
|
||||
# ifdef Version3_4
|
||||
/* This has not been tested */
|
||||
# define LIBPKG_CONFIG -I/usr/include/EXOS -DSGI_EXCELAN
|
||||
# define LIBPKG_SETUP cp /usr/lib/libsocket.a PRODUCTS
|
||||
# define LIBFB_OBJS if_remote pkg sgiselect.o if_sgi
|
||||
# define LIBFB_SETUP (rm -fr tmp; mkdir tmp; \
|
||||
rm -f libfb.a; cd tmp; \
|
||||
AR x /usr/lib/libsocket.a; \
|
||||
AR uv ../libfb.a *; \
|
||||
rm -f *; \
|
||||
AR x /usr/lib/libgl2.a; \
|
||||
AR u ../libfb.a *; \
|
||||
cd ..; rm -fr tmp)
|
||||
# define RFBD_CONFIG -I/usr/include/EXOS -DSGI_EXCELAN
|
||||
# define MGED_LIBES ../libfb/sgiselect.o -lgl2
|
||||
# else
|
||||
/* Versions 3.5 and 3.6 */
|
||||
# define LIBSYSV_SETUP ( \
|
||||
AR x /usr/lib/libbsd.a select.o getdtab.o; \
|
||||
AR u libsysv.a select.o getdtab.o)
|
||||
# define LIBSYSV_OBJ select.o
|
||||
# define LIBPKG_CONFIG -I/usr/include/bsd -DBSD=42
|
||||
# define LIBPKG_SETUP cp /usr/lib/libbsd.a PRODUCTS
|
||||
# define LIBFB_OBJS if_remote pkg if_sgi
|
||||
# define LIBFB_SETUP (rm -fr tmp; mkdir tmp; \
|
||||
rm -f libfb.a; cd tmp; \
|
||||
AR x /usr/lib/libdbm.a; \
|
||||
AR x /usr/lib/libgl2.a; \
|
||||
rm -f select.o; \
|
||||
AR x /usr/lib/libbsd.a; \
|
||||
rm -f __.SYMDEF; \
|
||||
AR u ../libfb.a *; \
|
||||
cd ..; rm -fr tmp)
|
||||
# define RFBD_CONFIG -I/usr/include/bsd -DBSD=42
|
||||
# define MGED_LIBES -lbsd -lgl2
|
||||
# endif
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_SGI
|
||||
# define LIBRT_TIMER timerunix
|
||||
#endif
|
||||
|
||||
#if defined(sgi) && defined(mips)
|
||||
/* Silicon Graphics 4D, which uses the MIPS chip */
|
||||
/*
|
||||
* NOTE: "IRIX 3.1" is the ONLY software release supported.
|
||||
* NOTE: If the shared library is used, then all machine types can
|
||||
* use the same binary programs, and no type discrimination is
|
||||
* necessary. However, this prevents PIXIE from working...
|
||||
*/
|
||||
# undef sgi
|
||||
# define GFLAG -G 16
|
||||
# define MTYPE 4d
|
||||
# define CC_OPTS GFLAG
|
||||
# if 1
|
||||
/* By default, use this for shared libraries */
|
||||
# define SHARED _s
|
||||
# else
|
||||
/* To use PIXIE, you have to use the non-shared libraries */
|
||||
# define SHARED /**/
|
||||
# endif
|
||||
# define STANDARD_LIBES -lm -lc''SHARED
|
||||
# define RT_LIBES -lmpc
|
||||
# define MGED_LIBES -lbsd -lgl''SHARED
|
||||
# define LGT_CONFIG GFLAG -lmpc
|
||||
# define LIBMALLOC /* needs malloc() from -lmpc */
|
||||
# define LIBFB_OBJS if_remote pkg if_4d
|
||||
# if 1
|
||||
/* Permit shared binaries, but no PostScript startoff
|
||||
* when not logged in */
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_4D -DSGI4D_Rel2
|
||||
# else
|
||||
/* Non-shared binaries, automatic PostScript startoff for rfbd */
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_4D
|
||||
# endif
|
||||
# define LIBFB_SETUP (rm -fr /usr/tmp/libfb; \
|
||||
mkdir /usr/tmp/libfb; \
|
||||
cp *.o /usr/tmp/libfb; \
|
||||
( cd /usr/tmp/libfb; \
|
||||
AR x /usr/lib/libgl''SHARED.a; \
|
||||
mv in_addr.o sgi_addr.o; \
|
||||
rm -f select.o *EBEB*; \
|
||||
AR x /usr/lib/libbsd.a; \
|
||||
AR u libfb.a * ); \
|
||||
mv /usr/tmp/libfb/libfb.a . ; \
|
||||
rm -fr /usr/tmp/libfb );
|
||||
# define HAS_TCP 1
|
||||
# define CC /usr/bin/cc
|
||||
# define LD_OPTS GFLAG
|
||||
# define OPTIMIZER -O2
|
||||
# define RANLIB ranlib5.sh
|
||||
# define GETHOST hostname
|
||||
# define LIBPKG_CONFIG -I/usr/include/bsd -DBSD=43
|
||||
# define RFBD_CONFIG -I/usr/include/bsd -DBSD=43
|
||||
# define LIBRT_TIMER timerunix
|
||||
# define MGED_OBJS dm-4d
|
||||
# define MGED_CONFIG GFLAG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_4D
|
||||
#endif
|
||||
|
||||
#if defined(sun) && !defined(sparc)
|
||||
/* SunOS 3.4, SunOS 4.0 */
|
||||
# undef sun
|
||||
# undef sun3
|
||||
# define MTYPE sun3
|
||||
# define BSD 42
|
||||
# define HAS_TCP 1
|
||||
/* Select correct floating point flag, -fswitch if unsure */
|
||||
# if 1
|
||||
/* Using the Sun Compiler (the default) */
|
||||
# if 0
|
||||
/* Generic unoptimized Sun configuration */
|
||||
# define CC_OPTS -fswitch
|
||||
# else
|
||||
/* Model-specific floating point options */
|
||||
/*# define CC_OPTS -ffpa */
|
||||
/*# define CC_OPTS -ffpa /usr/lib/ffpa.il*/
|
||||
/*# define CC_OPTS -f68881 -g*/
|
||||
# define CC_OPTS -f68881 /usr/lib/f68881.il
|
||||
# define LD_OPTS -f68881
|
||||
# endif
|
||||
# else
|
||||
/* Using the Gnu C Compiler */
|
||||
# define CC gcc
|
||||
# if 0
|
||||
/* Use this one to generate code */
|
||||
# define CC_OPTS -traditional -g
|
||||
# else
|
||||
/* Use this one as an "ansi lint" -- don't use the code! */
|
||||
# define CC_OPTS -ansi -g -pedantic -Wall
|
||||
# endif
|
||||
# endif
|
||||
# define FC_OPTS CC_OPTS
|
||||
# ifndef LD_OPTS
|
||||
# define LD_OPTS CC_OPTS
|
||||
# endif
|
||||
# define LIBMALLOC /* must use libc.a, for _malloc_at_addr() */
|
||||
# define LIBRT_TIMER timer42
|
||||
# if 1
|
||||
/* Normal Sun configuration */
|
||||
# define LIBFB_OBJS if_remote pkg if_sun
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_SUN
|
||||
# define LIBFB_SETUP (rm -fr tmp; mkdir tmp; \
|
||||
rm -f libfb.a; cd tmp; \
|
||||
AR x /usr/lib/libsuntool.a; \
|
||||
AR x /usr/lib/libsunwindow.a; \
|
||||
AR x /usr/lib/libpixrect.a; \
|
||||
AR u ../libfb.a *; \
|
||||
cd ..; rm -fr tmp)
|
||||
# define MGED_OBJS dm-sun
|
||||
# define MGED_CONFIG -DDM_SUNPW
|
||||
# define MGED_LIBES -lsuntool -lsunwindow -lpixrect
|
||||
# else
|
||||
/* Sun with X11 configuration */
|
||||
# define LIBFB_OBJS if_remote pkg if_sun if_X
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_SUN -DIF_X
|
||||
# define LIBFB_SETUP (rm -fr tmp; mkdir tmp; \
|
||||
rm -f libfb.a; cd tmp; \
|
||||
AR x /usr/lib/libsuntool.a; \
|
||||
AR x /usr/lib/libsunwindow.a; \
|
||||
AR x /usr/lib/libpixrect.a; \
|
||||
AR x /usr/lib/libX11.a; \
|
||||
rm -f __.SYMDEF; \
|
||||
AR u ../libfb.a *; \
|
||||
cd ..; rm -fr tmp)
|
||||
# define MGED_OBJS dm-sun dm-X
|
||||
# define MGED_CONFIG -DDM_SUNPW -DDM_X
|
||||
# define MGED_LIBES -lsuntool -lsunwindow -lpixrect \
|
||||
/usr/lib/libX11.a
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(sparc)
|
||||
# undef sun
|
||||
# undef sun4
|
||||
# define MTYPE sun4
|
||||
# define BSD 42
|
||||
# define HAS_TCP 1
|
||||
# define OPTIMIZER -O2
|
||||
# define LIBMALLOC /* use vendor library */
|
||||
# define LIBFB_OBJS if_remote pkg if_sun
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_SUN
|
||||
# define LIBFB_SETUP (rm -fr /usr/tmp/libfb; \
|
||||
mkdir /usr/tmp/libfb; \
|
||||
( cd /usr/tmp/libfb; \
|
||||
cp /usr/lib/libsuntool.a libfb.a; \
|
||||
AR x /usr/lib/libsunwindow.a; \
|
||||
AR x /usr/lib/libpixrect.a; \
|
||||
AR u libfb.a * ); \
|
||||
mv /usr/tmp/libfb/libfb.a . ; \
|
||||
rm -fr /usr/tmp/libfb )
|
||||
# define LIBRT_TIMER timer42
|
||||
# define MGED_OBJS dm-sun
|
||||
# define MGED_CONFIG -DDM_SUNPW
|
||||
# define MGED_LIBES -lsuntool -lsunwindow -lpixrect
|
||||
#endif
|
||||
|
||||
#if defined(apollo)
|
||||
# undef apollo
|
||||
# define MTYPE apollo
|
||||
# define UNIXTYPE SYSV
|
||||
# define HAS_TCP 1
|
||||
# define CC_OPTS
|
||||
# define FC_OPTS CC_OPTS
|
||||
# define LD_OPTS CC_OPTS
|
||||
# define LIBMALLOC /* may be able to use local libmalloc */
|
||||
# define LIBRT_TIMER timerunix
|
||||
# define LIBFB_OBJS
|
||||
# define LIBFB_CONFIG
|
||||
# define LIBFB_SETUP
|
||||
# define MGED_OBJS
|
||||
# define MGED_CONFIG
|
||||
# define MGED_LIBES
|
||||
#endif
|
||||
|
||||
#if defined(CRAY1)
|
||||
/* Cray X-M/P running UNICOS. Define CRAY_COS for use on COS. */
|
||||
# undef xmp
|
||||
# undef cray
|
||||
# define MTYPE xmp
|
||||
# define HAS_TCP 1
|
||||
/* -g -hnobtreg for debugging */
|
||||
# if 1
|
||||
# define CC_DEFS -hvector,olevel_3
|
||||
# else
|
||||
/* Cray C 4.0 (experimental) */
|
||||
# define CC_DEFS -hvector,olevel_3,vmesg_2
|
||||
# define CC /bin/ncc
|
||||
# endif
|
||||
# define LIBMALLOC /* use vendor library */
|
||||
# define RFBD_LIBES -lbsd
|
||||
# define LIBRT_TIMER timerunix
|
||||
# define RT_LIBES -L/lib/multi -lu -lio
|
||||
# define LGT_CONFIG -Dcray
|
||||
# define LIBTERMLIB -lcurses
|
||||
# if 1
|
||||
/* On XMP UNICOS 4.0, archives finally end in .a */
|
||||
# define ARCH_SUF a
|
||||
# define FC /bin/cf77
|
||||
# define AR ../cray-ar.sh
|
||||
# define LIBPKG_CONFIG -DBSD=42 -DOLDTCP
|
||||
# define RFBD_CONFIG -DBSD=42 -DOLDTCP
|
||||
# else
|
||||
# if 1
|
||||
/* XMP UNICOS 5.0 */
|
||||
# define LIBPKG_CONFIG -DBSD=43
|
||||
# define RFBD_CONFIG -DBSD=43
|
||||
# else
|
||||
/* On XMP UNICOS 3.0, archives still end in .o */
|
||||
# define ARCH_SUF o
|
||||
# define FC /bin/cc
|
||||
# define AR ../cray-ar.sh
|
||||
# define LIBPKG_CONFIG -DBSD=42 -DOLDTCP
|
||||
# define RFBD_CONFIG -DBSD=42 -DOLDTCP
|
||||
# endif
|
||||
# endif
|
||||
# define RANLIB echo
|
||||
# define LIBPKG_SETUP cp /usr/lib/libnet.ARCH_SUF PRODUCTS
|
||||
# define LIBFB_SETUP cp /usr/lib/libnet.ARCH_SUF PRODUCTS
|
||||
#endif
|
||||
|
||||
#if defined(CRAY2)
|
||||
/* Cray-2 running UNICOS */
|
||||
# undef cr2
|
||||
# undef cray
|
||||
# define MTYPE cr2
|
||||
# define HAS_TCP 1
|
||||
# if 1
|
||||
/* Cray ANSI Standard C */
|
||||
# define CC /bin/scc
|
||||
# define CC_DEFS -hvreport
|
||||
# else
|
||||
# if 1
|
||||
/* Plain old /bin/cc */
|
||||
# define CC_DEFS -hvector,olevel_3
|
||||
# else
|
||||
/* Cray C 4.0 (experimental) */
|
||||
# define CC_DEFS -hvector,olevel_3,vmesg_2
|
||||
# define CC /bin/ncc
|
||||
# endif
|
||||
# endif
|
||||
# define LIB_PRE -L
|
||||
# define FC /bin/cf77
|
||||
# define RANLIB echo
|
||||
# define LIBSYSV_SETUP ( \
|
||||
AR x /usr/lib/libnet.a select.o socket.o; \
|
||||
AR u libsysv.a select.o socket.o )
|
||||
# define LIBMALLOC /* use vendor library */
|
||||
# if 1
|
||||
/* UNICOS 4.0 */
|
||||
# define LIBPKG_CONFIG -DBSD=42 -DOLDTCP
|
||||
# define RFBD_CONFIG -DBSD=42 -DOLDTCP
|
||||
# else
|
||||
/* UNICOS 5.0 */
|
||||
# define LIBPKG_CONFIG -DBSD=43
|
||||
# define RFBD_CONFIG -DBSD=43
|
||||
# endif
|
||||
# define LIBRT_TIMER timerunix
|
||||
# define RT_LIBES -lmt
|
||||
# define LGT_CONFIG -Dcray
|
||||
# define LIBPKG_SETUP cp /usr/lib/libnet.ARCH_SUF PRODUCTS
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_X -I/usr/include/X11
|
||||
# define LIBFB_OBJS if_remote pkg if_X
|
||||
# define LIBFB_SETUP (rm -fr tmp; mkdir tmp; \
|
||||
cp /usr/lib/libX11.a PRODUCTS; \
|
||||
cd tmp; \
|
||||
AR x /usr/lib/libnet.a; \
|
||||
rm -f select.o; \
|
||||
AR u ../PRODUCTS *; \
|
||||
cd ..; rm -fr tmp)
|
||||
# define MGED_OBJS dm-X
|
||||
# define MGED_CONFIG -DDM_X
|
||||
/* MGED_LIBES should read /usr/lib/libX11.a /usr/lib/libnet.a,
|
||||
* but we have to use LIBFB instead, to avoid a duplicate select.o
|
||||
* module (libnet.a, LIBSYSV). SEGLDR is a bitter pill.
|
||||
*/
|
||||
# define MGED_LIBES LIBFB
|
||||
#endif
|
||||
|
||||
#ifdef convex
|
||||
# undef convex
|
||||
# undef c1
|
||||
# define MTYPE c1
|
||||
# define BSD 42
|
||||
# define HAS_TCP 1
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_PTTY
|
||||
# define LIBFB_OBJS if_remote pkg if_ptty
|
||||
# define LIBRT_TIMER timer42
|
||||
# define FC /usr/convex/fc
|
||||
/* libplot3/htond.c depends on running in native mode (CC_OPTS= -fn) */
|
||||
# if 0
|
||||
/* Optional vectorizing C compiler */
|
||||
# define OPTIMIZER -O2
|
||||
# define CC /usr/convex/vc
|
||||
# if 1
|
||||
# define CC_OPTS -fn
|
||||
# else
|
||||
# define CC_OPTS -DVECTORIZE -fn
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef ardent
|
||||
/* This configuration information is based on a preliminary test */
|
||||
# undef ard
|
||||
# define MTYPE ard
|
||||
/* The network code is not tested with BRL-CAD yet */
|
||||
# define HAS_TCP 0
|
||||
# define LIBRT_TIMER timerunix
|
||||
/* Note that -O2 causes multiple compiler failures */
|
||||
# define OPTIMIZER -O1
|
||||
/* Note that a cc -43 option gives a workable BSD environment */
|
||||
/*XXX Note that this X11 configuration may need tweaking */
|
||||
# define LIBFB_CONFIG -DIF_X
|
||||
# define LIBFB_OBJS if_X
|
||||
# define LIBFB_SETUP cp /usr/lib/libX11.a PRODUCTS
|
||||
# define MGED_OBJS dm-X
|
||||
# define MGED_CONFIG -DDM_X
|
||||
# define MGED_LIBES /usr/lib/libX11.a
|
||||
#endif
|
||||
|
||||
#ifdef stellar
|
||||
/* This configuration information is based on a preliminary test */
|
||||
# undef stl
|
||||
# define MTYPE stl
|
||||
/* The network code is not tested with BRL-CAD yet */
|
||||
# define HAS_TCP 0
|
||||
# define LIBRT_TIMER timerunix
|
||||
/*XXX Note that this X11 configuration may need tweaking */
|
||||
# define LIBFB_CONFIG -DIF_X
|
||||
# define LIBFB_OBJS if_X
|
||||
# define LIBFB_SETUP cp /usr/lib/libX11.a PRODUCTS
|
||||
# define MGED_OBJS dm-X
|
||||
# define MGED_CONFIG -DDM_X
|
||||
# define MGED_LIBES /usr/lib/libX11.a
|
||||
#endif
|
||||
|
||||
#ifdef eta10
|
||||
/* This configuration information is based on a preliminary test */
|
||||
# undef eta
|
||||
# define MTYPE eta
|
||||
# define HAS_TCP 0
|
||||
# define LIBRT_TIMER timerunix
|
||||
#endif
|
||||
|
||||
#ifdef pyr
|
||||
# undef pyr
|
||||
# define MTYPE pyr
|
||||
# define BSD 42
|
||||
# define HAS_TCP 1
|
||||
# define CC_DEFS -Dvoid=int
|
||||
# define LIBRT_TIMER timer42
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototype System V machine
|
||||
*/
|
||||
#ifdef RANDOM_SYSV
|
||||
# define MTYPE unknown_sysv
|
||||
# define HAS_TCP 0
|
||||
# define LIBRT_TIMER timerunix
|
||||
#endif
|
||||
|
||||
#ifdef VLD
|
||||
/* Not yet shaken out for use with Cake */
|
||||
# define HAS_TCP 0
|
||||
# define CC_DEFS -DVLDSYSV
|
||||
# define LIBRT_TIMER timer52brl
|
||||
# define CC /usr/5bin/cc
|
||||
# define RANLIB ranlib
|
||||
# define BINDIR /vld/bin
|
||||
# define LIBDIR /vld/lib
|
||||
# define ETCDIR /vld/etc
|
||||
# define MANDIR /usr/5lib/man/local/min
|
||||
#endif
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* END System-specific definitions *
|
||||
* *
|
||||
* Please do not modify anything below here without being *
|
||||
* quite certain of what you are doing (or at least keeping *
|
||||
* good backups!). *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
#if !defined(MTYPE)
|
||||
# include "It is necessary to define the machine type as MTYPE"
|
||||
#endif
|
||||
|
||||
#if !defined(HAS_TCP)
|
||||
# include "It is necessary to define HAS_TCP as either 0 or 1"
|
||||
#endif
|
||||
|
||||
#if !defined(CC_DEFS)
|
||||
# define CC_DEFS /**/
|
||||
#endif
|
||||
|
||||
#if !defined(CC_OPTS)
|
||||
# define CC_OPTS /**/
|
||||
#endif
|
||||
|
||||
#if !defined(FC_OPTS)
|
||||
# define FC_OPTS /**/
|
||||
#endif
|
||||
|
||||
#if !defined(LD_OPTS)
|
||||
# define LD_OPTS /**/
|
||||
#endif
|
||||
|
||||
/* Provide defaults here */
|
||||
#if !defined(LIBFB_OBJS) || !defined(LIBFB_CONFIG)
|
||||
# if HAS_TCP == 0
|
||||
# define LIBFB_OBJS if_ptty
|
||||
# define LIBFB_CONFIG -DIF_PTTY
|
||||
# else
|
||||
# define LIBFB_OBJS if_remote pkg if_ptty
|
||||
# define LIBFB_CONFIG -DIF_REMOTE -DIF_PTTY
|
||||
# endif
|
||||
/* LIBFB_SETUP is only to be defined when needed */
|
||||
#endif
|
||||
|
||||
/* LIBSYSV_SETUP is only to be defined when needed */
|
||||
|
||||
#ifndef RT_CONFIG
|
||||
# define RT_CONFIG /**/
|
||||
#endif
|
||||
|
||||
#ifndef RT_LIBES
|
||||
# define RT_LIBES /**/
|
||||
#endif
|
||||
|
||||
#ifndef LGT_CONFIG
|
||||
# define LGT_CONFIG /**/
|
||||
#endif
|
||||
|
||||
#ifndef RFBD_CONFIG
|
||||
# define RFBD_CONFIG /**/
|
||||
#endif
|
||||
|
||||
#ifndef RFBD_LIBES
|
||||
# define RFBD_LIBES /**/
|
||||
#endif
|
||||
|
||||
#ifndef LIBPKG_CONFIG
|
||||
# define LIBPKG_CONFIG /**/
|
||||
#endif
|
||||
|
||||
#ifndef MGED_CONFIG
|
||||
# define MGED_CONFIG /**/
|
||||
#endif
|
||||
|
||||
#ifndef MGED_OBJS
|
||||
# define MGED_OBJS /**/
|
||||
#endif
|
||||
|
||||
#ifndef MGED_LIBES
|
||||
# define MGED_LIBES /**/
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Provide paths for programs, etc.
|
||||
* Don't add comments after a definition, the extra tabs ruin things
|
||||
*/
|
||||
#ifndef CC
|
||||
# define CC /bin/cc
|
||||
#endif
|
||||
#ifndef FC
|
||||
# define FC /usr/bin/f77
|
||||
#endif
|
||||
|
||||
#if !defined(GETHOST)
|
||||
# ifdef BSD
|
||||
# define GETHOST hostname
|
||||
# else
|
||||
# define GETHOST uname -n
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(RANLIB)
|
||||
# ifdef BSD
|
||||
# define RANLIB ranlib
|
||||
# else
|
||||
/* Can be defined in specific config as "echo" to no-op */
|
||||
# define RANLIB ranlib5.sh
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(BINDIR)
|
||||
/* Define places where users can find "installed" copies of things */
|
||||
# define BINDIR /usr/brlcad/bin
|
||||
# define LIBDIR /usr/brlcad/lib
|
||||
# define ETCDIR /usr/brlcad/etc
|
||||
# define INCLUDE_DIR /usr/include/brlcad
|
||||
#endif
|
||||
|
||||
/* Permissions for "installed" files of various types */
|
||||
#define BINPERM 775
|
||||
#define LIBPERM 664
|
||||
#define MANPERM 664
|
||||
#define DIRPERM 775
|
||||
|
||||
#if !defined(ARCH_SUF)
|
||||
/* Suffix for archives. "a" on most UNIX machine, "o" on XMP */
|
||||
# define ARCH_SUF a
|
||||
#endif
|
||||
|
||||
#if !defined(LIB_PRE)
|
||||
/* Prefix for archives; usually null, "-L" on Cray-2 */
|
||||
# define LIB_PRE /**/
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Places to find the working copies of the libraries
|
||||
* If the binaries are to be separated from the sources,
|
||||
* as is needed in a multi-machine NFS environment,
|
||||
* then a second directory is made for every source directory,
|
||||
* with the machine name appended to the source directory name.
|
||||
*
|
||||
* For the purposes of Cray-2 LIB_PRE, there can only be ONE tab
|
||||
* character between the symbol name and the definition.
|
||||
*/
|
||||
/**GAK, no string compares in #if */
|
||||
|
||||
#if !NFS
|
||||
/* Local style, binaries in source directories */
|
||||
# define LIBFB ../libfb/libfb.ARCH_SUF
|
||||
# define LIBRT ../librt/librt.ARCH_SUF
|
||||
# define LIBPLOT ../libplot3/libplot3.ARCH_SUF
|
||||
# define LIBORLE ../liborle/liborle.ARCH_SUF
|
||||
# define LIBRLE ../librle/librle.ARCH_SUF
|
||||
# define LIBWDB ../libwdb/libwdb.ARCH_SUF
|
||||
# define LIBSPL ../libspl/libspl.ARCH_SUF
|
||||
# define LIBTERMIO ../libtermio/libtermio.ARCH_SUF
|
||||
# define LIBCURSOR ../libcursor/libcursor.ARCH_SUF
|
||||
# define LIBFONT ../libfont/libfont.ARCH_SUF
|
||||
# define LIBSYSV ../libsysv/libsysv.ARCH_SUF
|
||||
# ifndef LIBMALLOC
|
||||
# define LIBMALLOC ../libmalloc/libmalloc.ARCH_SUF
|
||||
# endif
|
||||
# if HAS_TCP
|
||||
# define LIBPKG ../libpkg/libpkg.ARCH_SUF
|
||||
# else
|
||||
# define LIBPKG /**/
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* NFS style, append machine name */
|
||||
# define LIBFB ../.libfb.MTYPE/libfb.ARCH_SUF
|
||||
# define LIBRT ../.librt.MTYPE/librt.ARCH_SUF
|
||||
# define LIBPLOT ../.libplot3.MTYPE/libplot3.ARCH_SUF
|
||||
# define LIBORLE ../.liborle.MTYPE/liborle.ARCH_SUF
|
||||
# define LIBRLE ../.librle.MTYPE/librle.ARCH_SUF
|
||||
# define LIBWDB ../.libwdb.MTYPE/libwdb.ARCH_SUF
|
||||
# define LIBSPL ../.libspl.MTYPE/libspl.ARCH_SUF
|
||||
# define LIBTERMIO ../.libtermio.MTYPE/libtermio.ARCH_SUF
|
||||
# define LIBCURSOR ../.libcursor.MTYPE/libcursor.ARCH_SUF
|
||||
# define LIBFONT ../.libfont.MTYPE/libfont.ARCH_SUF
|
||||
# define LIBSYSV ../.libsysv.MTYPE/libsysv.ARCH_SUF
|
||||
# ifndef LIBMALLOC
|
||||
# define LIBMALLOC ../.libmalloc.MTYPE/libmalloc.ARCH_SUF
|
||||
# endif
|
||||
# if HAS_TCP
|
||||
# define LIBPKG ../.libpkg.MTYPE/libpkg.ARCH_SUF
|
||||
# else
|
||||
# define LIBPKG /**/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(LIBTERMLIB)
|
||||
# define LIBTERMLIB -ltermlib
|
||||
#endif
|
||||
|
||||
#if !defined(MANDIR)
|
||||
# ifdef BSD
|
||||
# define MANDIR /usr/man/man
|
||||
# else
|
||||
# define MANDIR /usr/man/u_man/man
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*****/
|
||||
|
||||
/* Directory within CAD tree for header files */
|
||||
#define INCDIR ../h
|
||||
|
||||
/* These should go after main Cakefile */
|
||||
#if !defined(OPTIMIZER)
|
||||
# define OPTIMIZER -O
|
||||
#endif
|
||||
#if !defined(PROFILER)
|
||||
# define PROFILER /**/
|
||||
#endif
|
||||
#if !defined(CONFIGDEFS)
|
||||
# define CONFIGDEFS /**/
|
||||
#endif
|
||||
|
||||
/* C compiler flags */
|
||||
#ifdef BSD
|
||||
# define CFLAGS CC_OPTS OPTIMIZER PROFILER -I''INCDIR -DBSD=BSD CC_DEFS CONFIGDEFS
|
||||
#else
|
||||
# define CFLAGS CC_OPTS OPTIMIZER PROFILER -I''INCDIR -DSYSV CC_DEFS CONFIGDEFS
|
||||
#endif
|
||||
|
||||
/* Loader flags. Note that CC is used to do the loading */
|
||||
#define LDFLAGS OPTIMIZER LD_OPTS CONFIGDEFS
|
||||
|
||||
/* FORTRAN flags */
|
||||
#define FFLAGS OPTIMIZER FC_OPTS
|
||||
|
||||
/* Lint flags */
|
||||
#define LINT lint
|
||||
#ifdef BSD
|
||||
# define LFLAGS -abchx -DBSD=BSD CC_DEFS CONFIGDEFS
|
||||
#else
|
||||
# define LFLAGS -DSYSV CC_DEFS CONFIGDEFS
|
||||
#endif
|
||||
|
||||
/* Archiver */
|
||||
#if !defined(AR)
|
||||
# define AR ar
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CC and LINT libraries. Everybody gets math library by default.
|
||||
* It is assumed that the loader searches -lc by default.
|
||||
* Switching to shared libraries can be used by re-defining STANDARD_LIBES.
|
||||
*/
|
||||
#if !defined(STANDARD_LIBES)
|
||||
# define STANDARD_LIBES -lm
|
||||
#endif
|
||||
#define LIBES LIB_PRE''LIBSYSV STANDARD_LIBES
|
||||
#define LLIBES STANDARD_LIBES
|
||||
|
||||
/* Program to install executables */
|
||||
#define INS cp
|
||||
|
||||
/* Command strings to typeset manual pages.
|
||||
* Usage is: TYPESET_MAN0 TYPESET_MAN1 *.MANSECTION TYPESET_MAN2
|
||||
* First version is 300dpi Imagen, then old Imagen, then plain troff
|
||||
*/
|
||||
#define TYPESET_MAN0 tbl
|
||||
#define TYPESET_MAN1 /usr/lib/tmac/tmac.an
|
||||
#define TYPESET_MAN2 /usr/5lib/troff -Ti300 | /usr/5bin/dimp -t | \
|
||||
qpr -q im231
|
||||
#ifdef never
|
||||
#define TYPESET_MAN2 | /usr/5lib/troff -Ti10 | /usr/5bin/di10 -t | \
|
||||
qpr -q im328-raw
|
||||
#endif
|
||||
#ifdef never
|
||||
#define TYPESET_MAN0 troff -man
|
||||
#define TYPESET_MAN1 /**/
|
||||
#define TYPESET_MAN2 /**/
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definition of master source machine, and master distribution
|
||||
* directory. Please don't change these values.
|
||||
* When the current host is == MASTERHOST, the "make install"
|
||||
* rules will also handle the distribution source management.
|
||||
* Even if you have lots of disk space, you don't want that
|
||||
* to happen.
|
||||
*/
|
||||
#define MASTERHOST spark.brl.mil
|
||||
#define DISTRIBUTION /m/dist
|
||||
|
||||
/* Symbols that should be defined in individual Cakefiles */
|
||||
/* PRODUCTS */
|
||||
/* MANSECTION */
|
||||
/* CONFIGDEFS */
|
||||
/* SRCDIR */
|
||||
/* AFTERINSTALL */
|
||||
|
||||
/* Cake-related definitions */
|
||||
#define BASE_FILES [[echo FILES|tr " " '\\\\012'|sed -e 's,.*''/,,']]
|
||||
#define SRC [[SUB X X''SRCSUFF FILES]]
|
||||
#define OBJ [[SUB X X''OBJSUFF BASE_FILES]]
|
||||
#define OBJSUFF .o
|
||||
#define HDR_DEP [[cakeinclude.sh ../SRCDIR/%.c INCDIR ../SRCDIR]]
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* C A K E F I L E . L I B
|
||||
*
|
||||
* Cakefile for building a single library archive.
|
||||
* Symbol PRODUCTS should be name of a single library
|
||||
*/
|
||||
|
||||
#ifndef PRODUCTS
|
||||
# include "Symbol PRODUCTS required to make library"
|
||||
#endif
|
||||
#ifndef SRCDIR
|
||||
# include "Symbol SRCDIR required"
|
||||
#endif
|
||||
#ifndef OBJ
|
||||
# include "Symbol OBJ required"
|
||||
#endif
|
||||
|
||||
#ifndef EXTRA_OBJ
|
||||
# define EXTRA_OBJ /**/
|
||||
#endif
|
||||
|
||||
#ifndef EXTRA_SETUP
|
||||
# define EXTRA_SETUP /**/
|
||||
#endif
|
||||
|
||||
PRODUCTS:: EXTRA_OBJ OBJ
|
||||
rm -f PRODUCTS; EXTRA_SETUP
|
||||
AR u PRODUCTS OBJ EXTRA_OBJ
|
||||
RANLIB PRODUCTS
|
||||
|
||||
%.o&: SRCDIR,,%,o if exist ../SRCDIR/%.c
|
||||
|
||||
%9,,%,o&: ../%9/%.c [[cakeinclude.sh ../%9/%.c INCDIR ../%9]] \
|
||||
if exist ../%9/%.c
|
||||
CC CFLAGS -c ../%9/%.c
|
||||
|
||||
/* Override the modes for the library */
|
||||
#undef BINDIR
|
||||
#undef BINPERM
|
||||
#define BINDIR LIBDIR
|
||||
#define BINPERM LIBPERM
|
||||
|
||||
/* If RANLIB is specified, be sure it is run when installing libraries */
|
||||
#define AFTERINSTALL RANLIB
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Cakefile.prog
|
||||
*
|
||||
* Like Cakefile.lib, this is the common part for making programs.
|
||||
*/
|
||||
|
||||
/* Default rule */
|
||||
everything&:: PRODUCTS
|
||||
|
||||
%.o: ../SRCDIR/%.c HDR_DEP if exist ../SRCDIR/%.c
|
||||
CC CFLAGS -c ../SRCDIR/%.c
|
||||
|
||||
%.o: ../SRCDIR/%.f if exist ../SRCDIR/%.f
|
||||
FC FFLAGS -c ../SRCDIR/%.f
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* C A K E F I L E . R U L E S
|
||||
*/
|
||||
|
||||
/*
|
||||
* Patterns to handle the installation and uninstallation
|
||||
* of products, manuals, and manual stubs.
|
||||
* This is complicated by the fact that not all directories
|
||||
* will contain all three types of items.
|
||||
*/
|
||||
#define MAN_EXISTS {{ls ../SRCDIR|grep -s .MANSECTION'$'}}
|
||||
#define STUB_EXISTS {{ls ../SRCDIR|grep -s .MANSECTION.stub'$'}}
|
||||
#define ARG_EXISTS {{ARGS="%"; test '%' != "$ARGS" -o -f %}}
|
||||
|
||||
/* Format sources for printing on stdout */
|
||||
print&: Cakefile.print \
|
||||
[[SUB X X.print ../SRCDIR/''*.[h''MANSECTION] ]] \
|
||||
[[SUB X X.nroff ../SRCDIR/''*.MANSECTION ]] \
|
||||
[[SUB X ../SRCDIR/X''SRCSUFF.print FILES]]
|
||||
|
||||
%.print&: do-%.print if ARG_EXISTS
|
||||
%.print&: if not ARG_EXISTS
|
||||
|
||||
do-%.print&:
|
||||
@pr %
|
||||
|
||||
/*
|
||||
*/
|
||||
nroff&: do-nroff if MAN_EXISTS
|
||||
nroff&: if not MAN_EXISTS
|
||||
|
||||
do-nroff&: [[SUB X X.nroff ../SRCDIR/''*.MANSECTION ]]
|
||||
|
||||
%.nroff&: ../SRCDIR/%
|
||||
@nroff -Tlp -man ../SRCDIR/%
|
||||
|
||||
/*
|
||||
* Typeset all the non-stub manual pages. Do them all at once,
|
||||
* to prevent lots of extra header sheets on the printer
|
||||
*
|
||||
* do-typeset-a creates the file "troff.out" with the macros in it
|
||||
* %.troff adds each manual page to "troff.out"
|
||||
*/
|
||||
typeset&: do-typeset if MAN_EXISTS
|
||||
typeset&: if not MAN_EXISTS
|
||||
|
||||
do-typeset&: do-typeset-a troff.out
|
||||
( TYPESET_MAN2 ) < troff.out
|
||||
@rm -f troff.out
|
||||
|
||||
do-typeset-a&:
|
||||
TYPESET_MAN0 TYPESET_MAN1 > troff.out
|
||||
|
||||
troff.out&: [[SUB X X.troff ../SRCDIR/''*.MANSECTION ]]
|
||||
|
||||
%.troff&: if ARG_EXISTS
|
||||
TYPESET_MAN0 % >> troff.out
|
||||
|
||||
#define SRC_LIST `SUB X ../SRCDIR/X''SRCSUFF FILES`
|
||||
|
||||
lint&:
|
||||
LINT LFLAGS -I''INCDIR SRC_LIST LLIBES > SRCDIR.lint
|
||||
|
||||
tags: [[echo SRC_LIST]]
|
||||
ctags SRC_LIST
|
||||
|
||||
flow&: [[echo SRC_LIST]]
|
||||
cflow -I''INCDIR SRC_LIST > SRCDIR.flow
|
||||
|
||||
xref&: [[echo SRC_LIST]]
|
||||
cxref -c -s -w132 -I''INCDIR SRC_LIST > SRCDIR.xref
|
||||
|
||||
compare&: [[SUB X X.compare PRODUCTS]]
|
||||
|
||||
%.compare&: %
|
||||
cmp BINDIR/% %
|
||||
|
||||
uninstall&: uninstall-prod uninstall-man uninstall-stub
|
||||
|
||||
#ifdef PRODUCTS
|
||||
uninstall-prod&: [[SUB X X.uninstall-prod PRODUCTS]]
|
||||
#else
|
||||
uninstall-prod&:
|
||||
#endif
|
||||
|
||||
%.uninstall-prod&:
|
||||
rm -f BINDIR/% BINDIR/%.bak
|
||||
|
||||
uninstall-man&: do-uninstall-man if MAN_EXISTS
|
||||
uninstall-man&: if not MAN_EXISTS
|
||||
|
||||
do-uninstall-man&: [[SUB ../SRCDIR/X X.uninstall-man ../SRCDIR/''*.MANSECTION]]
|
||||
|
||||
%.uninstall-man&:
|
||||
rm -f MANDIR''MANSECTION/% MANDIR''MANSECTION/%.bak
|
||||
|
||||
uninstall-stub&: do-uninstall-stub if STUB_EXISTS
|
||||
uninstall-stub&: if not STUB_EXISTS
|
||||
|
||||
do-uninstall-stub&: [[SUB ../SRCDIR/X.stub X.uninstall-stub ../SRCDIR/''*.stub]]
|
||||
|
||||
%.uninstall-stub&:
|
||||
rm -f MANDIR''MANSECTION/% MANDIR''MANSECTION/%.bak
|
||||
|
||||
#if !defined(DONT_INSTALL)
|
||||
install&: install-prod install-man install-stub inst-dist
|
||||
|
||||
install-nobak&: install-prod-nobak install-man install-stub inst-dist
|
||||
#else
|
||||
install&: inst-dist
|
||||
|
||||
install-nobak&: inst-dist
|
||||
#endif
|
||||
|
||||
#if defined(PRODUCTS)
|
||||
install-prod&: [[SUB X X.iprod PRODUCTS]]
|
||||
|
||||
install-prod-nobak&: [[SUB X X.iprod-nobak PRODUCTS]]
|
||||
#else
|
||||
install-prod&:
|
||||
|
||||
install-prod-nobak&:
|
||||
#endif
|
||||
|
||||
/* Here is where we depend on having /bin/sh as the shell */
|
||||
%.iprod&: %
|
||||
@echo ......checking % 1>&2 ; \
|
||||
if cmp -s BINDIR/% %; \
|
||||
then exit 0; fi; \
|
||||
mv -f BINDIR/% BINDIR/%.bak 2>/dev/null; \
|
||||
if INS % BINDIR/%; \
|
||||
then if test x''AFTERINSTALL != x'AFTERINSTALL'; \
|
||||
then AFTERINSTALL BINDIR/%; fi; \
|
||||
echo "++++++INSTALLED" BINDIR/% 1>&2; \
|
||||
chmod BINPERM BINDIR/%; \
|
||||
fi
|
||||
|
||||
%.iprod-nobak&: %
|
||||
@echo ......checking % 1>&2 ; \
|
||||
if cmp -s BINDIR/% %; \
|
||||
then exit 0; fi; \
|
||||
rm -f BINDIR/% 2>/dev/null; \
|
||||
if INS % BINDIR/%; \
|
||||
then if test x''AFTERINSTALL != x'AFTERINSTALL'; \
|
||||
then AFTERINSTALL BINDIR/%; fi; \
|
||||
echo "++++++INSTALLED" BINDIR/% 1>&2; \
|
||||
chmod BINPERM BINDIR/%; \
|
||||
fi
|
||||
|
||||
install-man&: do-install-man if MAN_EXISTS
|
||||
install-man&: if not MAN_EXISTS
|
||||
|
||||
do-install-man&: [[SUB ../SRCDIR/X X.install-man ../SRCDIR/''*.MANSECTION ]]
|
||||
|
||||
%.install-man&: ../SRCDIR/%
|
||||
@if cmp -s MANDIR''MANSECTION/% ../SRCDIR/%; \
|
||||
then exit 0; fi; \
|
||||
mv -f MANDIR''MANSECTION/% MANDIR''MANSECTION/%.bak 2>/dev/null; \
|
||||
if INS ../SRCDIR/% MANDIR''MANSECTION/%; \
|
||||
then echo "++++++INSTALLED" MANDIR''MANSECTION/% 1>&2; \
|
||||
chmod MANPERM MANDIR''MANSECTION/%; \
|
||||
fi
|
||||
|
||||
install-stub&: do-install-stub if STUB_EXISTS
|
||||
install-stub&: if not STUB_EXISTS
|
||||
|
||||
do-install-stub&: [[SUB ../SRCDIR/X.stub X.install-stub ../SRCDIR/''*.stub]]
|
||||
|
||||
%.install-stub&: ../SRCDIR/%.stub
|
||||
@if cmp -s MANDIR''MANSECTION/% ../SRCDIR/%.stub; \
|
||||
then exit 0; fi; \
|
||||
mv -f MANDIR''MANSECTION/% MANDIR''MANSECTION/%.bak 2>/dev/null; \
|
||||
if INS ../SRCDIR/%.stub MANDIR''MANSECTION/%; \
|
||||
then echo "++++++INSTALLED" MANDIR''MANSECTION/% 1>&2; \
|
||||
chmod MANPERM MANDIR''MANSECTION/%; \
|
||||
fi
|
||||
|
||||
/*
|
||||
* Force installation of copies of all sources,
|
||||
* whether configured in or not, into the distribution tree.
|
||||
*/
|
||||
#ifndef STATIC_PRODUCTS
|
||||
# define STATIC_PRODUCTS /**/
|
||||
#endif
|
||||
#ifdef NFS
|
||||
#define INSTALL_PATTERNS STATIC_PRODUCTS \
|
||||
../SRCDIR/Cakefile ../SRCDIR/\\\\*.[hcsfyl] \
|
||||
../SRCDIR/\\\\*.sh \
|
||||
../SRCDIR/\\\\*.MANSECTION ../SRCDIR/\\\\*.MANSECTION.stub \
|
||||
../SRCDIR/\\\\*.doc
|
||||
#else
|
||||
#define INSTALL_PATTERNS STATIC_PRODUCTS \
|
||||
./Cakefile \\\\*.[hcsfyl] \\\\*.sh \
|
||||
\\\\*.MANSECTION \\\\*.MANSECTION.stub \\\\*.doc
|
||||
#endif
|
||||
#define IS_MASTER {{test x''MASTERHOST = x`GETHOST`}}
|
||||
|
||||
inst-dist&: inst-dist-main if IS_MASTER
|
||||
|
||||
/* inst-dist is also called from "install", so say nothing if not master */
|
||||
inst-dist&: if not IS_MASTER
|
||||
|
||||
inst-dist-main&: dist-clobber [[SUB X X.do-inst-dist INSTALL_PATTERNS]]
|
||||
|
||||
dist-clobber&:
|
||||
-rm -fr DISTRIBUTION/SRCDIR
|
||||
mkdir DISTRIBUTION/SRCDIR; chmod 775 DISTRIBUTION/SRCDIR
|
||||
|
||||
%.do-inst-dist&: %.inst-dist if ARG_EXISTS
|
||||
%.do-inst-dist&: if not ARG_EXISTS
|
||||
|
||||
%.inst-dist&:
|
||||
-INS % DISTRIBUTION/SRCDIR/.
|
||||
|
||||
/*
|
||||
* clean remove all .o files and by-products
|
||||
* noprod remove the final executables
|
||||
* clobber perform clean & noprod
|
||||
*/
|
||||
clobber&: clean noprod
|
||||
|
||||
clean&:
|
||||
-rm -f core *~ *.o SRCDIR.out SRCDIR.err SRCDIR.xref SRCDIR.flow SRCDIR.lint
|
||||
|
||||
noprod&:
|
||||
-rm -f PRODUCTS
|
||||
|
||||
#ifdef never
|
||||
/*
|
||||
* Insist that, by default, Cake work on making the products.
|
||||
* THIS SHOULD BE THE LAST THING CAKE SEES!
|
||||
* The double-colon marks this as the main target.
|
||||
*/
|
||||
"!MAINCAKE!"&:: PRODUCTS
|
||||
#endif
|
||||
@@ -1,22 +0,0 @@
|
||||
This software was developed by and is proprietary to the United States
|
||||
Government, and any use of the software without the written permission
|
||||
of the Ballistic Research Laboratory is strictly prohibited. Any
|
||||
unauthorized use of the software will be construed as an infringement of
|
||||
the Government's rights and will subject the unauthorized user to
|
||||
action(s) for infringement damages. (BRL MFR 380-15, Feb-88)
|
||||
The terms and conditions for the use of this software are detailed
|
||||
in your distribution agreement.
|
||||
|
||||
Please note that portions of this software and the associated databases
|
||||
and images are Copyright (C) 1985, 1986, 1987, 1988, 1989 by the United
|
||||
States Army. Unauthorized redistribution in any form is prohibited.
|
||||
Recipients of this distribution are authorized unlimited use within
|
||||
their corporation, organization, or agency.
|
||||
|
||||
There is no warranty or other guarantee of fitness for this software,
|
||||
it is provided solely "as is". Bug reports or fixes must be sent
|
||||
to BRL, which may or may not act on them.
|
||||
|
||||
The software in the "contributed" directory is Public Domain, Distribution
|
||||
Unlimited. In addition, certain other modules in the BRL-CAD package
|
||||
bear this designation. Files so marked are available for unlimited use.
|
||||
@@ -1,69 +0,0 @@
|
||||
#################################################################
|
||||
# #
|
||||
# Makefile #
|
||||
# #
|
||||
# The top-level Makefile for the BRL CAD Software Distribution #
|
||||
# #
|
||||
# This exists mostly as a convienience, so folks can #
|
||||
# type "make install" and such like, and get the expected #
|
||||
# results, even in the face of the rather complex mechanism. #
|
||||
# Thus, we make Make into a simple front-end for gen.sh #
|
||||
# #
|
||||
# Author - #
|
||||
# Michael John Muuss #
|
||||
# #
|
||||
# Source - #
|
||||
# SECAD/VLD Computing Consortium, Bldg 394 #
|
||||
# The U. S. Army Ballistic Research Laboratory #
|
||||
# Aberdeen Proving Ground, Maryland 21005-5066 #
|
||||
# #
|
||||
# $Header$ #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# Main rule (default):
|
||||
all:
|
||||
-@sh gen.sh all
|
||||
|
||||
help:
|
||||
-@sh gen.sh help
|
||||
benchmark:
|
||||
-@sh gen.sh $@
|
||||
depend:
|
||||
-@sh gen.sh $@
|
||||
install:
|
||||
-@sh gen.sh $@
|
||||
inst-man:
|
||||
-@sh gen.sh $@
|
||||
uninstall:
|
||||
-@sh gen.sh $@
|
||||
inst-dist:
|
||||
-@sh gen.sh $@
|
||||
clean:
|
||||
-@sh gen.sh $@
|
||||
noprod:
|
||||
-@sh gen.sh $@
|
||||
clobber:
|
||||
-@sh gen.sh $@
|
||||
lint:
|
||||
-@sh gen.sh $@
|
||||
ls:
|
||||
-@sh gen.sh $@
|
||||
print:
|
||||
-@sh gen.sh $@
|
||||
typeset:
|
||||
-@sh gen.sh $@
|
||||
checkin:
|
||||
-@sh gen.sh $@
|
||||
dist:
|
||||
-@sh gen.sh $@
|
||||
arch:
|
||||
-@sh gen.sh $@
|
||||
mkdir:
|
||||
-@sh gen.sh $@
|
||||
relink:
|
||||
-@sh gen.sh $@
|
||||
rmdir:
|
||||
-@sh gen.sh $@
|
||||
-451
@@ -1,451 +0,0 @@
|
||||
#################################################################
|
||||
# #
|
||||
# Makefile.defs #
|
||||
# #
|
||||
# This Makefile contains definitions common to most of the #
|
||||
# software packages contained in this distribution. #
|
||||
# Combined with Makefile.rules and a directory-specific #
|
||||
# Makefile.loc to create full MAKE input. #
|
||||
# #
|
||||
# Each source directory contains a Makefile with these #
|
||||
# contents: #
|
||||
# #
|
||||
#everything: #
|
||||
# make $(MFLAGS) -$(MAKEFLAGS) \ #
|
||||
# -f ../Makefile.defs -f Makefile.loc \ #
|
||||
# -f ../Makefile.rules #
|
||||
#.DEFAULT: #
|
||||
# make $(MFLAGS) -$(MAKEFLAGS) \ #
|
||||
# -f ../Makefile.defs -f Makefile.loc \ #
|
||||
# -f ../Makefile.rules $@ #
|
||||
# #
|
||||
# so that the local rules and definitions for each directory #
|
||||
# are combined with the common rules and definitions. #
|
||||
# #
|
||||
# Author - #
|
||||
# Michael John Muuss #
|
||||
# #
|
||||
# Source - #
|
||||
# SECAD/VLD Computing Consortium, Bldg 394 #
|
||||
# The U. S. Army Ballistic Research Laboratory #
|
||||
# Aberdeen Proving Ground, Maryland 21005 #
|
||||
# #
|
||||
# Acknowledgements - #
|
||||
# This Makefile draws heavily on Doug Gwyn's #
|
||||
# VLD Standard Makefile, and Doug Kingston's #
|
||||
# MMDF Global Makefile. #
|
||||
# #
|
||||
# $Header$ #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Operating System Definition and Compiler Flags #
|
||||
# #
|
||||
# Either "BSD" or "SYSV" *MUST* be defined #
|
||||
# #
|
||||
# Oddball compiler/loader directives should also go here #
|
||||
# On parallel machines, if h/machine.h does not define #
|
||||
# the PARALLEL flag, it should be done here. #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#VAX#SYSTEM = -DBSD
|
||||
#SYSV#SYSTEM = -DSYSV
|
||||
#VLD#SYSTEM = -DSYSV -DVLDSYSV
|
||||
# Silicon Graphics, -Zf if Weitek FP chip installed
|
||||
#SGI#SYSTEM = -DSYSV -Zf
|
||||
#SGI#SYSTEM = -DSYSV
|
||||
#ALLIANT#SYSTEM = -DBSD -ce
|
||||
#GOULD#SYSTEM = -DBSD -m 8
|
||||
#XMP#SYSTEM = -DSYSV -DPARALLEL
|
||||
#XMP2.1#SYSTEM = -DSYSV -DPARALLEL -holevel_0
|
||||
#CRAY2#SYSTEM = -DSYSV -DPARALLEL -Dcray
|
||||
# Sun3, select correct floating point flag, or -fswitch if unsure (slower)
|
||||
#SUN3#SYSTEM = -DBSD -f68881
|
||||
#SUN3#SYSTEM = -DBSD -ffpa
|
||||
#SUN3#SYSTEM = -DBSD -fswitch
|
||||
#PYRAMID#SYSTEM = -DBSD -Dvoid=int
|
||||
#ULTRIX1#SYSTEM = -DBSD -Dvoid=int
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# System-Version information, for special handling within one #
|
||||
# type of $SYSTEM. #
|
||||
# #
|
||||
# Currently meaningful settings are: #
|
||||
# #
|
||||
# SGI34 SGI release 3.4 and below, with EXCELAN TCP. #
|
||||
# SGI35 SGI release 3.5 and above, with real TCP. #
|
||||
# UNICOS20 Cray UNICOS 2.0, with TCP #
|
||||
# SUN3 SUN UNIX version 3.2 or above #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#SGI#SYSVERS = SGI34
|
||||
#SGI#SYSVERS = SGI35
|
||||
#4D#SYSVERS = 4D32
|
||||
#XMP#SYSVERS = UNICOS20
|
||||
#CRAY2#SYSVERS = UNICOS20
|
||||
#SUN#SYSVERS = SUN3
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Definitions specific to one portion of the CAD distribution, #
|
||||
# but collected here for ease of configuration #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for libpkg #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#SGI34#LIBPKG_CONFIG = -I/usr/include/EXOS -DSGI_EXCELAN
|
||||
#SGI35#LIBPKG_CONFIG = -I/usr/include/bsd -DBSD
|
||||
#4D32#LIBPKG_CONFIG = -I/usr/include/bsd -DBSD
|
||||
#XMP#LIBPKG_CONFIG = -I/usr/win-include -DBSD -DSHORT_IDENT -DCRAY
|
||||
#CRAY2#LIBPKG_CONFIG = -I/usr/win-include -DBSD -DSHORT_IDENT -DCRAY
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for remrt #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#SGI34#REMRT_CONFIG = -I/usr/include/EXOS -DSGI_EXCELAN
|
||||
#SGI35#REMRT_CONFIG = -I/usr/include/bsd -DBSD
|
||||
#4D32#REMRT_CONFIG = -I/usr/include/bsd -DBSD
|
||||
#XMP#REMRT_CONFIG = -I/usr/win-include -DBSD -DSHORT_IDENT -DCRAY
|
||||
#CRAY2#REMRT_CONFIG = -I/usr/win-include -DBSD -DSHORT_IDENT -DCRAY
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for rfbd #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#SGI35#RFBD_CONFIG = -I/usr/include/bsd -DBSD
|
||||
#4D32#RFBD_CONFIG = -I/usr/include/bsd -DBSD
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for libfb #
|
||||
# #
|
||||
# Specify all OPTIONAL framebuffer interfaces to attach. #
|
||||
# Select from: #
|
||||
# if_remote Network access to remote display #
|
||||
# if_adage Adage RDS-3000 ("Ikonas") #
|
||||
# if_sgi SGI IRIS display #
|
||||
# if_ptty AT&T 5620 w/special Moss layer #
|
||||
# if_sun SUNView interface #
|
||||
# if_ug Ultra Graphics device #
|
||||
# if_rat Raster Technology One/80 (24-bit RGB) #
|
||||
# if_4d SGI 4D/60T "clover" workstation
|
||||
# #
|
||||
# Edit all three LIBFB_* lines below similarly. #
|
||||
# NOTES: #
|
||||
# 1) When TCP exists and if_remote is desired, set #
|
||||
# LIBFB_OBJS = if_remote.o pkg.o #
|
||||
# to gain access to the PKG routines. #
|
||||
# #
|
||||
# 2) For SGI release 3.4 and below, but not 3.5 and above: #
|
||||
# LIBFB_OBJS = if_remote.o ../libpkg/pkg.o sgiselect.o #
|
||||
# #
|
||||
# 3) For SGIs which have MC 68010 CPUs (not Turbos or #
|
||||
# 30xx machines), be certain to uncomment -DMC_68010, #
|
||||
# because the default is a 68020 #
|
||||
# #
|
||||
LIBFB_CFILES = if_remote.c \
|
||||
if_ptty.c
|
||||
#VAX# if_adage.c
|
||||
#SGI# if_sgi.c
|
||||
#SUN# if_sun.c
|
||||
#4D32# if_4d.c
|
||||
LIBFB_OBJS = if_remote.o pkg.o \
|
||||
if_ptty.o
|
||||
#VAX# if_adage.o
|
||||
#SGI35# if_sgi.o
|
||||
#SGI34# if_sgi.o sgiselect.o
|
||||
#SUN# if_sun.o
|
||||
#4D32# if_4d.o
|
||||
LIBFB_CONFIG = -DIF_REMOTE \
|
||||
-DIF_PTTY
|
||||
#VAX# -DIF_ADAGE
|
||||
#SGI# -DIF_SGI # -DMC_68010
|
||||
#SUN# -DIF_SUN
|
||||
#4D32# -DIF_4D
|
||||
#USNA# -DIF_ADAGE -DGM256
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for librt #
|
||||
# #
|
||||
# Select one of: #
|
||||
# timer42 4.2 BSD, 4.3 BSD (Berkeley UNIX) #
|
||||
# timerunix Generic UNIX, System III, V, etc. #
|
||||
# timer52brl For BRL's System 5-under-4.n BSD #
|
||||
# timerhep Denelcor HEP #
|
||||
# timercray Cray-X/MP UNICOS #
|
||||
LIBRT_TIMER = timer42
|
||||
#SYSV#LIBRT_TIMER = timerunix
|
||||
#XMP#LIBRT_TIMER = timercray
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for RT #
|
||||
# #
|
||||
# Mostly useful for specification of multi-processing #
|
||||
# versions of libc, etc. #
|
||||
# #
|
||||
#XMP#RT_CONFIG = -L/lib/multi -lu
|
||||
#CRAY2#RT_CONFIG = -lmt
|
||||
#4D32#RT_CONFIG = -lbsd
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Configuration for mged #
|
||||
# #
|
||||
# If you wish MGED usage logging, add #
|
||||
# -DLOGFILE=/file/name to MGED_CONFIG #
|
||||
# #
|
||||
# At present, MGED operates on these types of #
|
||||
# display hardware by default: #
|
||||
# dm-plot any UNIX-plot filter #
|
||||
# dm-tek Tektronix 4014 and family #
|
||||
# dm-tek4109 Tektronix 4109 #
|
||||
# and also supports these optional display devices: #
|
||||
# dm-vg Vector General 3300 #
|
||||
# dm-mg Megatek 7250 #
|
||||
# dm-ir SGI IRIS 2400,3030 (uses lib -lgl2) #
|
||||
# dm-sun SUN 3.2 Pixwin #
|
||||
# dm-rat Raster Tech One/180,380 #
|
||||
# dm-rat80 Raster Tech One/80 #
|
||||
# dm-ps E&S Picture System 300 #
|
||||
# dm-4d Silicon Graphics 4D/60T
|
||||
# dm-mer Megatek Merlin 9200 [ Marginal ] #
|
||||
# dm-sab Saber w/GOPS [ Marginal ] #
|
||||
# #
|
||||
# Specify all OPTIONAL display managers to attach. #
|
||||
# #
|
||||
#VAX#MGED_CFILES = dm-mg.c dm-vg.c
|
||||
#VAX#MGED_OBJS = dm-mg.o dm-vg.o
|
||||
#VAX#MGED_CONFIG = -DDM_MG -DDM_VG
|
||||
#VAX#MGED_LIBES =
|
||||
#
|
||||
#4D32#MGED_CFILES = dm-4d.c
|
||||
#4D32#MGED_OBJS = dm-4d.o
|
||||
#4D32#MGED_CONFIG = -G 64 -DDM_4D
|
||||
#4D32#MGED_LIBES = -lbsd -lgl
|
||||
#
|
||||
#SGI#MGED_CFILES = dm-ir.c
|
||||
#SGI#MGED_OBJS = dm-ir.o
|
||||
#SGI#MGED_CONFIG = -DDM_IR # -DMC_68010
|
||||
#SGIXNS#MGED_CONFIG = -DDM_IR -DNONBLOCK # -DMC_68010
|
||||
#SGI35#MGED_LIBES = -lbsd -lgl2
|
||||
#SGI34#MGED_LIBES = ../libfb/sgiselect.o -lgl2
|
||||
# #
|
||||
#SUN#MGED_CFILES = dm-sun.c
|
||||
#SUN#MGED_OBJS = dm-sun.o
|
||||
#SUN#MGED_CONFIG = -DDM_SUNPW
|
||||
#SUN#MGED_LIBES = -lsuntool -lsunwindow -lpixrect
|
||||
# #
|
||||
# Pick the right script for generating the version string: #
|
||||
# Depends on differing behaviors of "echo" command #
|
||||
# #
|
||||
MGED_VERS = newvers.sh
|
||||
#SYSV#MGED_VERS = newvers5.sh
|
||||
#VLD#MGED_VERS = newversVLD.sh
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Paths for programs, libraries, etc #
|
||||
# Defined here to provide "optimal managerial flexibility" #
|
||||
# #
|
||||
# Note: Don't add comments after a definition, #
|
||||
# the extra white space can ruin some of the expansions. #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
CC = /bin/cc
|
||||
#4D32#CC = /usr/bin/cc
|
||||
#VLD#CC = /usr/5bin/cc
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
MAKE = /bin/make
|
||||
|
||||
# Makefiles to print
|
||||
MAKEFILE = ../Makefile.defs ./Makefile.loc ../Makefile.rules ./Makefile
|
||||
|
||||
# Program to get name of current system
|
||||
GETHOST = hostname
|
||||
#SYSV#GETHOST = uname -n
|
||||
#4D32#GETHOST = hostname
|
||||
|
||||
# If BSD42, use ranlib on archives. For SYSV, set to "echo" (except SGI).
|
||||
RANLIB = ranlib
|
||||
#SYSV#RANLIB = echo
|
||||
#VLD#RANLIB = ranlib
|
||||
#SGI#RANLIB = ranlib
|
||||
#4D32#RANLIB = ar ts
|
||||
|
||||
# Place to install binary executable
|
||||
BINDIR = /usr/brlcad/bin
|
||||
#VLD#BINDIR = /vld/bin
|
||||
|
||||
# Place to install (and find) libraries
|
||||
LIBDIR = /usr/brlcad/lib
|
||||
#VLD#LIBDIR = /vld/lib
|
||||
|
||||
# Place to install daemons and other non-user-command type programs
|
||||
ETCDIR = /usr/brlcad/etc
|
||||
|
||||
# Suffix for archives. Won't change for most UNIX machines, but...
|
||||
ARCH_SUF = a
|
||||
#XMP#ARCH_SUF = o
|
||||
|
||||
# For utilities that wish to USE our libraries, here are the popular ones:
|
||||
LIBFB = ../libfb.'`sh ../mtype.sh`'/libfb.${ARCH_SUF}
|
||||
LIBRT = ../librt.'`sh ../mtype.sh`'/librt.${ARCH_SUF}
|
||||
LIBPLOT = ../libplot3.'`sh ../mtype.sh`'/libplot3.${ARCH_SUF}
|
||||
LIBRLE = ../librle.'`sh ../mtype.sh`'/librle.${ARCH_SUF}
|
||||
LIBPKG = ../libpkg.'`sh ../mtype.sh`'/libpkg.${ARCH_SUF}
|
||||
LIBWDB = ../libwdb.'`sh ../mtype.sh`'/libwdb.${ARCH_SUF}
|
||||
LIBSPL = ../libspl.'`sh ../mtype.sh`'/libspl.${ARCH_SUF}
|
||||
LIBTERMLIB = -ltermlib
|
||||
#XMP#LIBTERMLIB = -lcurses
|
||||
LIBTERMIO = ../libtermio.'`sh ../mtype.sh`'/libtermio.${ARCH_SUF}
|
||||
LIBCURSOR = ../libcursor.'`sh ../mtype.sh`'/libcursor.${ARCH_SUF}
|
||||
LIBSYSV = ../libsysv.'`sh ../mtype.sh`'/libsysv.${ARCH_SUF}
|
||||
#SYSV#LIBSYSV =
|
||||
|
||||
# For strictly serial machines, the Princeton malloc() in libmalloc
|
||||
# uses address space and physical memory more efficiently than the
|
||||
# Berkeley/CalTech malloc(), but with the same performance advantage.
|
||||
# It works well on VAXen and Goulds and SGIs. Sadly, it does not work
|
||||
# on the SUNs.
|
||||
# For parallel machines, the vendor's malloc() typically needs to be
|
||||
# used, to handle parallel stack frame expansion, etc. This is
|
||||
# significant on the Cray and HEP, and perhaps others.
|
||||
LIBMALLOC = ../libmalloc/libmalloc.${ARCH_SUF}
|
||||
#SUN#LIBMALLOC = # Forced to use vendor malloc
|
||||
#XMP#LIBMALLOC = # Forced to use vendor malloc
|
||||
#CRAY2#LIBMALLOC = # Forced to use vendor malloc
|
||||
|
||||
# Directory within CAD Package for header files
|
||||
INCDIR = ../h
|
||||
|
||||
# Directory where users can find installed copies of header files.
|
||||
INCLUDE_DIR = /usr/include/brlcad
|
||||
#VLD#INCLUDE_DIR = /vld/include
|
||||
|
||||
# Directory for Manual pages, when ${MANSECTION} appended
|
||||
MANDIR = /usr/man/man
|
||||
#SYSV#MANDIR = /usr/man/u_man/man
|
||||
#VLD#MANDIR = /usr/5lib/man/local/man
|
||||
|
||||
# Permissions for files to be installed
|
||||
BINPERM = 775
|
||||
MANPERM = 664
|
||||
LIBPERM = 664
|
||||
DIRPERM = 775
|
||||
|
||||
# Compiler Flags
|
||||
PROFILE =
|
||||
CFLAGS = -O ${PROFILE} -I${INCDIR} ${SYSTEM} ${CONFIGDEFS}
|
||||
#4D#CFLAGS = -O2 ${PROFILE} -I${INCDIR} ${SYSTEM} ${CONFIGDEFS}
|
||||
|
||||
# Loader Flags. Note that ${CC} is used to invoke the loader
|
||||
LDFLAGS = ${SYSTEM} ${PROFILE}
|
||||
#4D#LDFLAGS = -O2 ${SYSTEM} ${PROFILE}
|
||||
|
||||
# Lint Flags
|
||||
LINT = lint
|
||||
LFLAGS = -hbvxac ${SYSTEM} ${CONFIGDEFS}
|
||||
#SYSV#LFLAGS = ${SYSTEM} ${CONFIGDEFS}
|
||||
|
||||
# Name of the object module archiver, for use with the loader.
|
||||
AR = ar
|
||||
#XMP#AR = ../cray-ar.sh
|
||||
|
||||
# Regular libraries. Everybody gets the math library; most need it.
|
||||
LIBES = -lm
|
||||
|
||||
# Lint libraries
|
||||
LLIBES = -lm
|
||||
|
||||
# Program to install executables
|
||||
INS = cp
|
||||
|
||||
# Command string to typeset manual pages
|
||||
# Usage is: ${TYPESET_MAN1} *.${MANSECTION} ${TYPESET_MAN2}
|
||||
#
|
||||
TYPESET_MAN1 = tbl /usr/lib/tmac/tmac.an
|
||||
TYPESET_MAN2 = | /usr/5lib/troff -Ti300 | /usr/5bin/dimp -t | \
|
||||
qpr -q im231
|
||||
#TYPESET_MAN1 = tbl /usr/lib/tmac/tmac.an
|
||||
#TYPESET_MAN2 = | /usr/5lib/troff -Ti10 | /usr/5bin/di10 -t | \
|
||||
qpr -q im328-raw
|
||||
#TYPESET_MAN1 = troff -man
|
||||
#TYPESET_MAN2 =
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Definition of master source machine, and master distribution #
|
||||
# directory. Please don't change these values. #
|
||||
# When the current host is == MASTERHOST, the "make install" #
|
||||
# rules will also handle the distribution source management. #
|
||||
# Even if you have lots of disk space, you don't want that #
|
||||
# to happen. #
|
||||
# #
|
||||
#################################################################
|
||||
MASTERHOST = brl-vgr
|
||||
DISTRIBUTION = /m/dist
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# Variables that will be defined in xxx/Makefile.loc #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
# Full names of final products
|
||||
PRODUCTS = product
|
||||
|
||||
# Names of local headers that contribute to product
|
||||
HEADERS =
|
||||
|
||||
# Names of C source files that contribute to product
|
||||
CFILES = cfiles.c
|
||||
|
||||
# Names of Shell files that contribute to product
|
||||
SHFILES =
|
||||
|
||||
# Section of manual to install pages in.
|
||||
# All the manual pages in a given directory MUST be in the same section.
|
||||
MANSECTION = 99
|
||||
|
||||
# ASCII Test files: input, and expected output
|
||||
TFILES =
|
||||
|
||||
# Any Configuration-specific definitions to pass to ${CC}, ie, -Dfoo=1
|
||||
CONFIGDEFS =
|
||||
|
||||
# Name of directory that holds the sources
|
||||
SRCDIR = xxx
|
||||
|
||||
# If special things (like ranlib) need doing after "make install",
|
||||
# xxx/Makefile.loc should set AFTERINSTALL=${RANLIB}
|
||||
AFTERINSTALL = echo
|
||||
# #
|
||||
#################################################################
|
||||
-217
@@ -1,217 +0,0 @@
|
||||
#################################################################
|
||||
# #
|
||||
# Makefile.rules #
|
||||
# #
|
||||
# Author - #
|
||||
# Michael John Muuss #
|
||||
# #
|
||||
# Source - #
|
||||
# SECAD/VLD Computing Consortium, Bldg 394 #
|
||||
# The U. S. Army Ballistic Research Laboratory #
|
||||
# Aberdeen Proving Ground, Maryland 21005 #
|
||||
# #
|
||||
# $Header$ #
|
||||
# #
|
||||
#################################################################
|
||||
|
||||
# Define default list of targets to be made
|
||||
all: ${PRODUCTS}
|
||||
|
||||
# Generic SCCS rule:
|
||||
#.DEFAULT:
|
||||
# $(GET) $(GFLAGS) -p s.$@ > $@
|
||||
# touch $@
|
||||
|
||||
# This is how to make the product, but may not always apply (eg, libs).
|
||||
# Also, this construct only works with the SysV make.
|
||||
#${PRODUCTS}: $$@.o ${OBJS}
|
||||
# $(CC) -o $@ ${LDFLAGS} $@.o ${OBJS} ${LIBES}
|
||||
# size $@
|
||||
|
||||
# Format sources for printing on stdout.
|
||||
# The invoker is responsible for diverting to their printer of choice.
|
||||
print: ${MAKEFILE} ${HEADERS} ${CFILES} ${TFILES}
|
||||
@pr ${MAKEFILE} ${HEADERS} ${CFILES} ${TFILES} *.${MANSECTION}
|
||||
@nroff -Tlp -man *.${MANSECTION}
|
||||
|
||||
# Don't bother doing the stub pages
|
||||
typeset:
|
||||
${TYPESET_MAN1} *.${MANSECTION} ${TYPESET_MAN2}
|
||||
|
||||
lint: ${HEADERS} ${CFILES}
|
||||
${LINT} ${LFLAGS} -I${INCDIR} ${CFILES} ${LLIBES} > ${SRCDIR}.lint
|
||||
|
||||
|
||||
tags: ${HEADERS} ${CFILES}
|
||||
ctags ${HEADERS} ${CFILES}
|
||||
|
||||
flow: ${HEADERS} ${CFILES}
|
||||
cflow -I${INCDIR} ${CFILES} > ${SRCDIR}.flow
|
||||
|
||||
xref: ${HEADERS} ${CFILES}
|
||||
cxref -c -s -w132 -I${INCDIR} ${CFILES} > ${SRCDIR}.xref
|
||||
|
||||
compare: all
|
||||
for prod in ${PRODUCTS} ; \
|
||||
do cmp ${BINDIR}/$$prod $$prod; \
|
||||
done
|
||||
|
||||
uninstall: all
|
||||
-@if test -n "${PRODUCTS}" ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) uninst-prod ; \
|
||||
fi
|
||||
-@files=`echo *.${MANSECTION}` ; \
|
||||
if test "$$files" != '*'.${MANSECTION} ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) uninst-man ; \
|
||||
fi
|
||||
-@files=`echo *.${MANSECTION}.stub` ; \
|
||||
if test "$$files" != '*'.${MANSECTION}.stub ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) uninst-stub ; \
|
||||
fi
|
||||
|
||||
uninst-prod:
|
||||
-@for prod in ${PRODUCTS} ; \
|
||||
do rm -f ${BINDIR}/$$prod ${BINDIR}/$$prod.bak 2>/dev/null; \
|
||||
done
|
||||
|
||||
uninst-man:
|
||||
-@for man in *.${MANSECTION} ; \
|
||||
do rm -f ${MANDIR}${MANSECTION}/$$man \
|
||||
${MANDIR}${MANSECTION}/$$man.bak 2>/dev/null ; \
|
||||
done
|
||||
|
||||
uninst-stub:
|
||||
-@for stub in *.${MANSECTION}.stub ; \
|
||||
do man=`basename $$stub .stub`; \
|
||||
rm -f ${MANDIR}${MANSECTION}/$$man \
|
||||
${MANDIR}${MANSECTION}/$$man.bak 2>/dev/null ; \
|
||||
done
|
||||
|
||||
# Handle all phases of final installation
|
||||
install: all
|
||||
-@if test -n "${PRODUCTS}" ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) inst-prod ; \
|
||||
fi
|
||||
-@files=`echo *.${MANSECTION}` ; \
|
||||
if test "$$files" != '*'.${MANSECTION} ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) inst-man ; \
|
||||
fi
|
||||
-@files=`echo *.${MANSECTION}.stub` ; \
|
||||
if test "$$files" != '*'.${MANSECTION}.stub ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) inst-stub ; \
|
||||
fi
|
||||
-@sh -c "if test `${GETHOST}` = ${MASTERHOST} ; then $(MAKE) inst-dist; else exit 0 ; fi"
|
||||
|
||||
# Install all products
|
||||
inst-prod: ${PRODUCTS}
|
||||
-@for prod in ${PRODUCTS} ; \
|
||||
do if cmp -s ${BINDIR}/$$prod $$prod; \
|
||||
then echo $$prod unchanged; \
|
||||
else mv -f ${BINDIR}/$$prod ${BINDIR}/$$prod.bak 2>/dev/null; \
|
||||
${INS} $$prod ${BINDIR} && \
|
||||
${AFTERINSTALL} ${BINDIR}/$$prod && \
|
||||
echo "++++++INSTALLED" ${BINDIR}/$$prod && \
|
||||
${AFTERINSTALL} ${BINDIR}/$$prod.bak && \
|
||||
chmod ${BINPERM} ${BINDIR}/$$prod; \
|
||||
fi \
|
||||
done
|
||||
|
||||
# Install the actual manual pages
|
||||
inst-man:
|
||||
-@for man in *.${MANSECTION} ; \
|
||||
do if cmp -s ${MANDIR}${MANSECTION}/$$man $$man; \
|
||||
then echo $$man unchanged; \
|
||||
else mv -f ${MANDIR}${MANSECTION}/$$man \
|
||||
${MANDIR}${MANSECTION}/$$man.bak 2>/dev/null ; \
|
||||
${INS} $$man ${MANDIR}${MANSECTION} && \
|
||||
echo "++++++INSTALLED" ${MANDIR}${MANSECTION}/$$man && \
|
||||
chmod ${MANPERM} ${MANDIR}${MANSECTION}/$$man; \
|
||||
fi \
|
||||
done
|
||||
|
||||
# Install the "stub" manual pages, which just source some other page
|
||||
inst-stub:
|
||||
-@for stub in *.${MANSECTION}.stub ; \
|
||||
do man=`basename $$stub .stub`; \
|
||||
if cmp -s ${MANDIR}${MANSECTION}/$$man $$stub; \
|
||||
then echo $$man unchanged; \
|
||||
else mv -f ${MANDIR}${MANSECTION}/$$man \
|
||||
${MANDIR}${MANSECTION}/$$man.bak 2>/dev/null ; \
|
||||
${INS} $$stub ${MANDIR}${MANSECTION}/$$man && \
|
||||
echo "++++++INSTALLED" ${MANDIR}${MANSECTION}/$$man && \
|
||||
chmod ${MANPERM} ${MANDIR}${MANSECTION}/$$man; \
|
||||
fi \
|
||||
done
|
||||
|
||||
|
||||
# It might be better to say ${HEADERS} ${CFILES} ${SFILES},
|
||||
# but that would miss routines that were not configured in a particular system.
|
||||
inst-dist:
|
||||
-rm -fr ${DISTRIBUTION}/${SRCDIR}/*
|
||||
-${INS} ./Makefile.loc Makefile *.[hcfs] ${SHFILES} \
|
||||
*.${MANSECTION} *.${MANSECTION}.stub \
|
||||
*.doc \
|
||||
${DISTRIBUTION}/${SRCDIR}/.
|
||||
|
||||
# running "make clobber" or "make clean noprod" will remove all binary files.
|
||||
# "clean" is intended to remove .o files and by-products.
|
||||
# "noprod" is intended to remove the final executables.
|
||||
# Either can be used without the other, depending on the effect desired.
|
||||
clobber: clean noprod
|
||||
|
||||
clean:
|
||||
-rm -f core *~ *.o \
|
||||
${SRCDIR}.out ${SRCDIR}.err ${SRCDIR}.xref \
|
||||
${SRCDIR}.flow ${SRCDIR}.lint
|
||||
|
||||
noprod:
|
||||
-rm -f ${PRODUCTS}
|
||||
|
||||
|
||||
#
|
||||
# Automaticly build #include dependencies.
|
||||
#
|
||||
# This code can't be simply replaced by the 4.3 BSD "cc -M".
|
||||
#
|
||||
# The convention for writing #include directives is:
|
||||
# #include "./file" gives file in current directory
|
||||
# #include "/file" gives file at absolute path
|
||||
# #include "file" gives file in ${INCDIR}
|
||||
# #include <file> leaves to CPP
|
||||
#
|
||||
# Note that there MUST be a SPACE after the "#include" in order to
|
||||
# be seen; this allows conditional includes (if needed) to be indicated
|
||||
# by a #include TAB, so as to not cause trouble.
|
||||
depend:
|
||||
-@if test -n "${CFILES}" ; \
|
||||
then $(MAKE) $(MFLAGS) -$(MAKEFLAGS) do-depend ; \
|
||||
fi
|
||||
|
||||
do-depend:
|
||||
cd ../${SRCDIR}; \
|
||||
mv -f Makefile.loc Makefile.bak; \
|
||||
cp Makefile.bak Makefile.loc; \
|
||||
chmod 664 Makefile.loc; \
|
||||
for k in ${CFILES}; do \
|
||||
i=`basename $$k .c`; \
|
||||
echo $$i.o: ../${SRCDIR}/$$k >>makedep; \
|
||||
grep '^#include ' /dev/null ../${SRCDIR}/$$k | sed \
|
||||
-e 's,^../'${SRCDIR}'/,,' \
|
||||
-e 's,c:[^"]*"\./\([^"]*\)".*,o: \1,' \
|
||||
-e 's,c:[^"]*"/\([^"]*\)".*,o: /\1,' \
|
||||
-e 's,c:[^"]*"\([^"]*\)".*,o: '${INCDIR}'/\1,' \
|
||||
-e '/debug.h/d' \
|
||||
-e '/c:[^<]*<\(.*\)>/d' \
|
||||
>>makedep; \
|
||||
echo ' $$(CC) $$(CFLAGS) -c ../'${SRCDIR}/$$k >>makedep; \
|
||||
done; \
|
||||
echo '# DO NOT DELETE THIS LINE -- make depend uses it' >>Makefile.loc; \
|
||||
echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile.loc; \
|
||||
echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep; \
|
||||
echo '$$r makedep' >>eddep; \
|
||||
echo 'w' >>eddep; \
|
||||
ed - Makefile.loc < eddep; \
|
||||
rm eddep makedep; \
|
||||
echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile.loc; \
|
||||
echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile.loc; \
|
||||
echo '# see make depend above' >> Makefile.loc
|
||||
@@ -1,193 +0,0 @@
|
||||
.\" $Header$
|
||||
.TL
|
||||
README
|
||||
.sp
|
||||
The Ballistic Research Laboratory CAD Package
|
||||
.br
|
||||
Release 3.5
|
||||
.br
|
||||
(29-May-1989)
|
||||
.RT
|
||||
.IP "VERSION"
|
||||
.sp
|
||||
This document is printed from the README file in the BRL-CAD distribution.
|
||||
The version in the printed manuals are usually somewhat older
|
||||
than the version on the actual distribution tape.
|
||||
When attempting to
|
||||
install the software, please refer to the documentation
|
||||
versions actually contained on the distribution tape.
|
||||
.sp
|
||||
.IP CONTENTS
|
||||
.sp
|
||||
This README file exists only to provide you a brief roadmap to
|
||||
the contents of the BRL-CAD distribution tape.
|
||||
The information on how to read the tape,
|
||||
install and operate the software,
|
||||
and perform the benchmark tests have become sufficiently large
|
||||
that they are now each a standalone document.
|
||||
.sp
|
||||
Please note that
|
||||
this distribution package does \fInot\fR include
|
||||
the various military-specific model
|
||||
analysis tools such as GIFT, SAR, SLAVE, VAST, etc., nor does it
|
||||
include any military databases.
|
||||
If you desire to have access to this material,
|
||||
please contact Keith Applin at (301)-278-6647.
|
||||
.sp
|
||||
.IP "INSTALLATION"
|
||||
.sp
|
||||
To install the BRL-CAD Package see the instructions in doc/install.doc.
|
||||
This file includes directions on the best way to read the distribution
|
||||
tape,
|
||||
as well as details on how to configure and install the software.
|
||||
This file also includes directions on how to compile and run
|
||||
the benchmark tests.
|
||||
.sp
|
||||
.IP "BENCHMARK"
|
||||
.sp
|
||||
See the paper in doc/benchmark.doc for information on
|
||||
analyzing the results of the benchmark tests.
|
||||
Comparisons between various different computers are listed.
|
||||
.sp
|
||||
.IP "BACKGROUND MATERIAL"
|
||||
.sp
|
||||
For overview information on the whole package, consult
|
||||
the overview paper in the file papers/overview, and
|
||||
the brlcad(1) manual page in the file util/brlcad.1.
|
||||
For a discussion of the significance of this software,
|
||||
read the paper "Understanding the Preparation and Analysis of Solid
|
||||
Models", included in the file papers/solid-models.
|
||||
.sp
|
||||
.IP "DISTRIBUTION DETAILS"
|
||||
.sp
|
||||
This section is included in the README file for two purposes.
|
||||
First, we wish to remind you of the terms of this limited distribution.
|
||||
Second, if you have obtained a copy of the printed documentation, and now
|
||||
wish to obtain a copy of the software, the procedures are listed here.
|
||||
.sp
|
||||
To obtain a copy of the distribution, you should send the authors:
|
||||
.sp
|
||||
1) Enough magnetic tape for 20 Mbytes of data. Standard nine-track
|
||||
half-inch magtape is the strongly preferred format, and can be written
|
||||
at either 1600 or 6250 bpi, in TAR format with 10k byte records. For
|
||||
sites with no half-inch tape drives, Silicon Graphics and SUN tape
|
||||
cartridges can also be accommodated, using QIC-24 format.
|
||||
.sp
|
||||
2) A letter indicating:
|
||||
.sp
|
||||
.nf
|
||||
-- Who you are
|
||||
-- What the BRL-CAD package is to be used for
|
||||
-- The equipment and operating system(s) you plan on using
|
||||
-- That you agree to the conditions listed below.
|
||||
.fi
|
||||
.sp
|
||||
It is vital that your letter include a sentence acknowledging your
|
||||
agreement to the conditions, such as "We agree to the
|
||||
conditions of the distribution listed in your letter".
|
||||
This software is an unpublished work that is not generally available to the
|
||||
public, except through the terms of this limited distribution.
|
||||
The United States Department of the Army grants a royalty-free,
|
||||
nonexclusive, nontransferable license and right to use,
|
||||
free of charge, with the following terms and conditions:
|
||||
.sp
|
||||
1. The BRL-CAD package source files will not be disclosed to third
|
||||
parties. BRL needs to know who has what, and what it is being used for.
|
||||
.sp
|
||||
2. BRL will be credited should the software be used in a product or written
|
||||
about in any publication. BRL will be referenced as the original
|
||||
source in any advertisements.
|
||||
.sp
|
||||
3. The software is provided "as is", without warranty by BRL.
|
||||
In no event shall BRL be liable for any loss or for any indirect,
|
||||
special, punitive, exemplary, incidental, or consequential damages
|
||||
arising from use, possession, or performance of the software.
|
||||
.sp
|
||||
4. When bugs or problems are found, you will make a reasonable effort
|
||||
to report them back to BRL.
|
||||
.sp
|
||||
5. Before using the software at additional sites, or for permission to
|
||||
use this work as part of a commercial package, you agree to first obtain
|
||||
authorization from BRL.
|
||||
.sp
|
||||
6. You will own full rights to any databases or images you create with this
|
||||
package.
|
||||
.sp
|
||||
All requests from US citizens, or from US government agencies should be
|
||||
sent to:
|
||||
.sp
|
||||
.nf
|
||||
.ne 1i
|
||||
Ballistic Research Lab
|
||||
Attn: Mike Muuss
|
||||
APG, MD 21005-5066
|
||||
.fi
|
||||
.sp
|
||||
If you are not a US citizen (regardless of any affiliation with a
|
||||
US industry), or if you represent a foreign-owned or foreign-controlled
|
||||
industry, you must send your letter and tape through your Ambassador to
|
||||
the United States in Washington DC. Have your Ambassador submit the
|
||||
request to:
|
||||
.sp
|
||||
.nf
|
||||
.ne 1i
|
||||
Army Headquarters
|
||||
Attn: DAMI-FL
|
||||
Washington, DC 20310
|
||||
.fi
|
||||
.sp
|
||||
Because distribution tapes are written by various members of the
|
||||
development team in their spare time, and because of vagaries in
|
||||
the supply of printed manuals, the turnaround time for responding
|
||||
to distribution requests varies from 1 to 12 weeks.
|
||||
.sp
|
||||
.ne 1i
|
||||
.IP "COMMUNICATION"
|
||||
.sp
|
||||
You are invited to participate in the DARPA InterNet (aka "ARPANET")
|
||||
electronic mailing list on the BRL-CAD software, which is called
|
||||
.sp .5
|
||||
.ti +1i
|
||||
<CAD @ BRL.MIL>.
|
||||
.sp .5
|
||||
Bug reports and discussions of new features
|
||||
are the main topics; volume of messages has been light (so far).
|
||||
Direct your bug reports to this address. Request a subscription by
|
||||
sending to
|
||||
.sp .5
|
||||
.ti +1i
|
||||
<CAD-REQUEST @ BRL.MIL>.
|
||||
.sp .5
|
||||
If you find bugs, please report your experiences via E-mail.
|
||||
While BRL makes no
|
||||
offer of support, we are most interested in hearing about your
|
||||
experiences.
|
||||
.sp
|
||||
.IP "FUTURE EVENTS"
|
||||
.sp
|
||||
It is expected that new releases of this software will be issued
|
||||
between once and twice a year.
|
||||
Information about new releases will be routinely provided
|
||||
by both paper and electronic mail
|
||||
to recipients of this software.
|
||||
If your address changes, please let us
|
||||
know, so we can update our records.
|
||||
.sp
|
||||
The BRL-CAD Symposium '88 was a big success.
|
||||
If you would be interested in attending the Symposium in '89,
|
||||
and especially if you would like to make a presentation, please
|
||||
contact Keith Applin <Keith@BRL.MIL>, or call 301-278-6647.
|
||||
.sp
|
||||
.KS
|
||||
.nf
|
||||
Best Wishes,
|
||||
-Mike Muuss
|
||||
.sp
|
||||
Leader, Advanced Computer Systems Team
|
||||
U.S. Army Ballistic Research Laboratory
|
||||
APG, MD. 21005-5066
|
||||
USA
|
||||
.sp
|
||||
ArpaNet: <Mike @ BRL.MIL>
|
||||
.KE
|
||||
.fi
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* bench/Cakefile
|
||||
*/
|
||||
|
||||
#define SRCDIR bench
|
||||
#define PRODUCTS pixcmp
|
||||
#define SRCSUFF .c
|
||||
#define MANSECTION 9
|
||||
|
||||
#define FILES pixcmp
|
||||
|
||||
#include "../Cakefile.defs"
|
||||
|
||||
/* These programs are not really for system-wide installation */
|
||||
#define DONT_INSTALL 1
|
||||
|
||||
#ifdef NFS
|
||||
/* Pick up any shell scripts needed */
|
||||
%.sh: if exist ../SRCDIR/%.sh
|
||||
rm -f %.sh
|
||||
ln ../SRCDIR/%.sh %.sh
|
||||
#endif
|
||||
|
||||
#include "../Cakefile.prog"
|
||||
|
||||
clobber&: xxclober
|
||||
@echo "About to wipe out all pictures and binary files in this directory"
|
||||
@echo "Send SIGINT (typ. ^C) within 3 seconds to abort"
|
||||
@sleep 5
|
||||
rm -f *.log.* *.pix.* # old versions
|
||||
rm -f *.log *.pix # last try
|
||||
|
||||
#define clobber xxclober /* rename "clobber" in Cakefile.rules */
|
||||
|
||||
pixcmp: OBJ
|
||||
CC LDFLAGS -o pixcmp OBJ
|
||||
|
||||
#include "../Cakefile.rules"
|
||||
-148
@@ -1,148 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A Shell script to test LGT
|
||||
# @(#)$Header$ (BRL)
|
||||
|
||||
# Ensure /bin/sh
|
||||
export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
|
||||
|
||||
eval `machinetype.sh -b` # sets MACHINE, UNIXTYPE, HAS_TCP
|
||||
if test -f ../.lgt.$MACHINE/lgt
|
||||
then
|
||||
LGT=../.lgt.$MACHINE/lgt
|
||||
DB=../.db.$MACHINE
|
||||
else
|
||||
if test -f ../lgt/lgt
|
||||
then
|
||||
LGT=../lgt/lgt
|
||||
DB=../db
|
||||
else
|
||||
echo "Can't find LGT"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CMP=./pixcmp
|
||||
if test ! -f $CMP
|
||||
then
|
||||
cake pixcmp
|
||||
fi
|
||||
|
||||
# Alliant NFS hack
|
||||
if test x${MACHINE} = xfx
|
||||
then
|
||||
cp ${LGT} /tmp/lgt
|
||||
cp ${CMP} /tmp/pixcmp
|
||||
LGT=/tmp/lgt
|
||||
CMP=/tmp/pixcmp
|
||||
fi
|
||||
|
||||
# This test of LGT assumes a "live" framebuffer here.
|
||||
if test x$FB_FILE = x
|
||||
then
|
||||
echo "Environment variable FB_FILE must be set to a real framebuffer"
|
||||
echo "for this test of LGT to operate correctly."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run the first set of tests
|
||||
|
||||
${LGT} ${DB}/lgt-test.g all.g << EOF
|
||||
# read light source data base
|
||||
v ../db/lgt-test.ldb
|
||||
# read material data base
|
||||
w ../db/lgt-test.mdb
|
||||
# force display window to be 512x512 pixels, should cause 8-to-1 zoom
|
||||
T 512
|
||||
# clear frame buffer
|
||||
E
|
||||
# set maximum bounces to 20
|
||||
K 20
|
||||
# turn hidden-line drawing off
|
||||
k 0
|
||||
# configure grid: 64 rays across
|
||||
G 64 0 0 0.0
|
||||
# turn perspective off
|
||||
p 0
|
||||
# change background to mauve
|
||||
b 111 66 66
|
||||
# read key frame
|
||||
j ../db/lgt-test.key
|
||||
# display view #3
|
||||
R
|
||||
# save image in file
|
||||
H lgt3a.pix
|
||||
# change frame buffer to disk file
|
||||
o lgt3b.pix
|
||||
# save a script of previous commands, to produce the "b" version.
|
||||
S script3
|
||||
# disable reading of key frame file
|
||||
j
|
||||
# change frame buffer back to default
|
||||
o
|
||||
# configure grid: 2.45 mm cells, centered about model origin, view size 225 mm
|
||||
G 2.45 1 1 225.0
|
||||
# change background to firebrick
|
||||
b 142 35 35
|
||||
# force frame buffer size to be 455 pixels across, should cause 4-to-1 zoom
|
||||
T 455
|
||||
# set automatic perspective at 0.25
|
||||
p 0.25
|
||||
# set anti-aliasing over-sampling factor to 2
|
||||
A 2
|
||||
# set maximum bounces to 20
|
||||
K 20
|
||||
# display view #1
|
||||
R
|
||||
# save image in file
|
||||
H lgt1a.pix
|
||||
# change frame buffer to disk file
|
||||
o lgt1b.pix
|
||||
# save a script
|
||||
S script1
|
||||
# change frame buffer back to default
|
||||
o
|
||||
# turn off anti-aliasing
|
||||
A 1
|
||||
# revert to auto-sizing of frame buffer
|
||||
T 0
|
||||
# set automatic perspective at 0.25
|
||||
p 0.25
|
||||
# select hidden-line drawing, reverse video
|
||||
k 2
|
||||
# configure grid: 128 rays across, centered at model RPP, view size 225mm
|
||||
G 128 0 0 225.0
|
||||
# display view #2
|
||||
R
|
||||
# save image in file
|
||||
H lgt2a.pix
|
||||
# change frame buffer to disk file
|
||||
o lgt2b.pix
|
||||
# save a script
|
||||
S script2
|
||||
# change frame buffer back to default
|
||||
o
|
||||
# bye
|
||||
q
|
||||
EOF
|
||||
if test $? = 0
|
||||
then :;
|
||||
else echo "Abnormal lgt exit"; exit 1
|
||||
fi
|
||||
|
||||
# Run the second set of tests. The scripts were created above.
|
||||
./script1 < /dev/null &&
|
||||
./script2 < /dev/null &&
|
||||
./script3 < /dev/null || { echo "Script test failed."; exit 1; }
|
||||
|
||||
for i in 1 2 3
|
||||
do
|
||||
if ${CMP} ../pix/lgt${i}.pix lgt${i}a.pix
|
||||
then :;
|
||||
else echo "Test $i A failed."; exit 1
|
||||
fi
|
||||
if ${CMP} ../pix/lgt${i}.pix lgt${i}b.pix
|
||||
then :;
|
||||
else echo "Test $i B failed."; exit 1
|
||||
fi
|
||||
done
|
||||
echo "Tested OK."
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A Shell script to extract the benchmark statistics, and build an
|
||||
# entry suitable for the tables in doc/benchmark.doc.
|
||||
# Note well that the command-line args may have embedded spaces.
|
||||
# Mike Muuss & Susan Muuss, 11-Sept-88.
|
||||
# @(#)$Header$ (BRL)
|
||||
|
||||
# Ensure /bin/sh
|
||||
export PATH || (sh $0 $*; kill $$)
|
||||
|
||||
NAME=$0
|
||||
if test "x$1" = x
|
||||
then
|
||||
echo "Usage: $NAME hostname [note1] [note2]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Save three args, because arg list will be reused below.
|
||||
# They may have embedded spaces in them.
|
||||
HOST="$1"
|
||||
NOTE1="$2"
|
||||
NOTE2="$3"
|
||||
|
||||
NEW_FILES="moss.log world.log star.log bldg391.log m35.log"
|
||||
REF_FILES="../pix/moss.log ../pix/world.log ../pix/star.log \
|
||||
../pix/bldg391.log ../pix/m35.log"
|
||||
|
||||
# Use TR to convert newlines to tabs.
|
||||
VGRREF=`grep RTFM $REF_FILES | \
|
||||
sed -n -e 's/^.*= *//' -e 's/ rays.*//p' | \
|
||||
tr '\012' '\011' `
|
||||
CURVALS=`grep RTFM $NEW_FILES | \
|
||||
sed -n -e 's/^.*= *//' -e 's/ rays.*//p' | \
|
||||
tr '\012' '\011' `
|
||||
|
||||
RATIO_LIST=""
|
||||
|
||||
# Trick: Force args $1 through $5 to the numbers in $CURVALS
|
||||
# This should be "set -- $CURVALS", but 4.2BSD /bin/sh can't handle it,
|
||||
# and CURVALS are all positive (ie, no leading dashes), so this is safe.
|
||||
set $CURVALS
|
||||
|
||||
if test $# != 5
|
||||
then echo "${NAME}: Error, only $# times found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for ref in $VGRREF
|
||||
do
|
||||
cur=$1
|
||||
shift
|
||||
RATIO=`echo "2k $cur $ref / p" | dc`
|
||||
# Note: append new value and a trail TAB to existing list.
|
||||
RATIO_LIST="${RATIO_LIST}$RATIO "
|
||||
done
|
||||
|
||||
# The number of plus signs must be one less than the number of elements.
|
||||
MEAN_ABS=`echo 2k $CURVALS ++++ 5/ p | dc`
|
||||
MEAN_REL=`echo 2k $RATIO_LIST ++++ 5/ p | dc`
|
||||
|
||||
# Note: Both RATIO_LIST and CURVALS have an extra trailing tab.
|
||||
# The question mark is for the mean field
|
||||
echo "Abs ${HOST} ${CURVALS}${MEAN_ABS} $NOTE1"
|
||||
echo "*vgr ${HOST} ${RATIO_LIST}${MEAN_REL} $NOTE2"
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* P I X C M P . C
|
||||
*
|
||||
* Compute the difference between two .pix files.
|
||||
* To establish context, a monochrome image is produced when there
|
||||
* are no differences; otherwise the channels that differ are
|
||||
* highlighted on differing pixels.
|
||||
*
|
||||
* This routine operates on a pixel-by-pixel basis, and thus
|
||||
* is independent of the resolution of the image.
|
||||
*
|
||||
* Author -
|
||||
* Charles M. Kennedy
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1988 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
long matching;
|
||||
long off1;
|
||||
long offmany;
|
||||
|
||||
char usage[] = "Usage: pixcmp f1.pix f2.pix\n";
|
||||
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
register FILE *f1, *f2;
|
||||
|
||||
if( argc != 3 ) {
|
||||
fprintf(stderr, "%s", usage);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if( strcmp( argv[1], "-" ) == 0 )
|
||||
f1 = stdin;
|
||||
else if( (f1 = fopen( argv[1], "r" ) ) == NULL ) {
|
||||
perror( argv[1] );
|
||||
exit(1);
|
||||
}
|
||||
if( strcmp( argv[2], "-" ) == 0 )
|
||||
f2 = stdin;
|
||||
else if( (f2 = fopen( argv[2], "r" ) ) == NULL ) {
|
||||
perror( argv[2] );
|
||||
exit(1);
|
||||
}
|
||||
while(1) {
|
||||
register int r1, g1, b1;
|
||||
int r2, g2, b2;
|
||||
|
||||
r1 = fgetc( f1 );
|
||||
g1 = fgetc( f1 );
|
||||
b1 = fgetc( f1 );
|
||||
r2 = fgetc( f2 );
|
||||
g2 = fgetc( f2 );
|
||||
b2 = fgetc( f2 );
|
||||
if( feof(f1) || feof(f2) ) break;
|
||||
|
||||
if( r1 != r2 || g1 != g2 || b1 != b2 ) {
|
||||
register int i;
|
||||
|
||||
/* Highlight differing channels */
|
||||
if( r1 != r2 ) {
|
||||
if( (i = r1 - r2) < 0 ) i = -i;
|
||||
if( i > 1 ) {
|
||||
offmany++;
|
||||
} else {
|
||||
off1++;
|
||||
}
|
||||
} else {
|
||||
matching++;
|
||||
}
|
||||
if( g1 != g2 ) {
|
||||
if( (i = g1 - g2) < 0 ) i = -i;
|
||||
if( i > 1 ) {
|
||||
offmany++;
|
||||
} else {
|
||||
off1++;
|
||||
}
|
||||
} else {
|
||||
matching++;
|
||||
}
|
||||
if( b1 != b2 ) {
|
||||
if( (i = b1 - b2) < 0 ) i = -i;
|
||||
if( i > 1 ) {
|
||||
offmany++;
|
||||
} else {
|
||||
off1++;
|
||||
}
|
||||
} else {
|
||||
matching++;
|
||||
}
|
||||
} else {
|
||||
/* Common case: equal. Give B&W NTSC average */
|
||||
matching += 3;
|
||||
}
|
||||
}
|
||||
fprintf(stderr,
|
||||
"pixcmp bytes: %7d matching, %7d off by 1, %7d off by many\n",
|
||||
matching, off1, offmany );
|
||||
|
||||
/* If files were of different lengths, that is an error */
|
||||
if( feof(f1) != feof(f2) )
|
||||
exit(2);
|
||||
|
||||
/* If any pixels were off by more than +/- 1, that is an error */
|
||||
if( offmany)
|
||||
exit(1);
|
||||
|
||||
/* Success! */
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
# WARNING THIS IS A REAL CPU HOG
|
||||
../rt/rt -p90 -f1024 -H3 -M $*\
|
||||
-o cube.pix\
|
||||
../db/cube.g\
|
||||
'all.g' \
|
||||
2> cube.log\
|
||||
<<EOF
|
||||
6.847580140e+03
|
||||
3.699276190e+03 3.032924070e+03 3.658674860e+03
|
||||
-5.735762590e-01 8.191521640e-01 0.000000000e+00 0.000000000e+00
|
||||
-3.461885920e-01 -2.424037690e-01 9.063078880e-01 0.000000000e+00
|
||||
7.424040310e-01 5.198366640e-01 4.226181980e-01 0.000000000e+00
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 1.000000000e+00
|
||||
EOF
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A Shell script to re-check the most recent results of the benchmark
|
||||
# @(#)$Header$ (BRL)
|
||||
|
||||
# Ensure /bin/sh
|
||||
export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
|
||||
|
||||
eval `machinetype.sh -b` # sets MACHINE, UNIXTYPE, HAS_TCP
|
||||
if test -f ../.util.$MACHINE/pixdiff
|
||||
then
|
||||
PIXDIFF=../.util.$MACHINE/pixdiff
|
||||
PIX_FB=../.util.$MACHINE/pix-fb
|
||||
else
|
||||
if test -f ../util/pixdiff
|
||||
then
|
||||
PIXDIFF=../util/pixdiff
|
||||
PIX_FB=../util/pix-fb
|
||||
else
|
||||
echo "Can't find pixdiff"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Alliant NFS hack
|
||||
if test x${MACHINE} = xfx
|
||||
then
|
||||
cp ${PIXDIFF} /tmp/pixdiff
|
||||
cp ${PIX_FB} /tmp/pix-fb
|
||||
PIXDIFF=/tmp/pixdiff
|
||||
PIX_FB=/tmp/pix-fb
|
||||
fi
|
||||
|
||||
echo +++++ moss.pix
|
||||
${PIXDIFF} ../pix/moss.pix moss.pix | ${PIX_FB}
|
||||
|
||||
echo +++++ world.pix
|
||||
${PIXDIFF} ../pix/world.pix world.pix | ${PIX_FB}
|
||||
|
||||
echo +++++ star.pix
|
||||
${PIXDIFF} ../pix/star.pix star.pix | ${PIX_FB}
|
||||
|
||||
echo +++++ bldg391.pix
|
||||
${PIXDIFF} ../pix/bldg391.pix bldg391.pix | ${PIX_FB}
|
||||
|
||||
echo +++++ m35.pix
|
||||
${PIXDIFF} ../pix/m35.pix m35.pix | ${PIX_FB}
|
||||
-177
@@ -1,177 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A Shell script to run the BRL-CAD Benchmark Test
|
||||
# @(#)$Header$ (BRL)
|
||||
|
||||
# Ensure /bin/sh
|
||||
export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
|
||||
|
||||
eval `machinetype.sh -b` # sets MACHINE, UNIXTYPE, HAS_TCP
|
||||
if test -f ../.rt.$MACHINE/rt
|
||||
then
|
||||
RT=../.rt.$MACHINE/rt
|
||||
DB=../.db.$MACHINE
|
||||
else
|
||||
if test -f ../rt/rt
|
||||
then
|
||||
RT=../rt/rt
|
||||
DB=../db
|
||||
else
|
||||
echo "Can't find RT"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CMP=./pixcmp
|
||||
if test ! -f $CMP
|
||||
then
|
||||
cake pixcmp
|
||||
fi
|
||||
|
||||
# Alliant NFS hack
|
||||
if test x${MACHINE} = xfx
|
||||
then
|
||||
cp ${RT} /tmp/rt
|
||||
cp ${CMP} /tmp/pixcmp
|
||||
RT=/tmp/rt
|
||||
CMP=/tmp/pixcmp
|
||||
fi
|
||||
|
||||
# Run the tests
|
||||
|
||||
echo +++++ moss
|
||||
if test -f moss.pix; then mv -f moss.pix moss.pix.$$; fi
|
||||
if test -f moss.log; then mv -f moss.log moss.log.$$; fi
|
||||
time $RT -B -M -s512 $* \
|
||||
-o moss.pix \
|
||||
$DB/moss.g all.g \
|
||||
2> moss.log \
|
||||
<< EOF
|
||||
viewsize 1.572026215e+02;
|
||||
eye_pt 6.379990387e+01 3.271768951e+01 3.366661453e+01;
|
||||
viewrot -5.735764503e-01 8.191520572e-01 0.000000000e+00
|
||||
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01
|
||||
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
|
||||
1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
${CMP} ../pix/moss.pix moss.pix
|
||||
if test $? = 0
|
||||
then
|
||||
echo moss.pix: answers are RIGHT
|
||||
else
|
||||
echo moss.pix: WRONG WRONG WRONG WRONG WRONG WRONG
|
||||
fi
|
||||
|
||||
echo +++++ world
|
||||
if test -f world.pix; then mv -f world.pix world.pix.$$; fi
|
||||
if test -f world.log; then mv -f world.log world.log.$$; fi
|
||||
time $RT -B -M -s512 $* \
|
||||
-o world.pix \
|
||||
$DB/world.g all.g \
|
||||
2> world.log \
|
||||
<< EOF
|
||||
viewsize 1.572026215e+02;
|
||||
eye_pt 6.379990387e+01 3.271768951e+01 3.366661453e+01;
|
||||
viewrot -5.735764503e-01 8.191520572e-01 0.000000000e+00
|
||||
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01
|
||||
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
|
||||
1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
${CMP} ../pix/world.pix world.pix
|
||||
if test $? = 0
|
||||
then
|
||||
echo world.pix: answers are RIGHT
|
||||
else
|
||||
echo world.pix: WRONG WRONG WRONG WRONG WRONG WRONG
|
||||
fi
|
||||
|
||||
echo +++++ star
|
||||
if test -f star.pix; then mv -f star.pix star.pix.$$; fi
|
||||
if test -f star.log; then mv -f star.log star.log.$$; fi
|
||||
time $RT -B -M -s512 $* \
|
||||
-o star.pix \
|
||||
$DB/star.g all \
|
||||
2> star.log \
|
||||
<<EOF
|
||||
viewsize 2.500000000e+05;
|
||||
eye_pt 2.102677960e+05 8.455500000e+04 2.934714650e+04;
|
||||
viewrot -6.733560560e-01 6.130643360e-01 4.132114880e-01 0.000000000e+00
|
||||
5.539599410e-01 4.823888300e-02 8.311441420e-01 0.000000000e+00
|
||||
4.896120540e-01 7.885590550e-01 -3.720948210e-01 0.000000000e+00
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
${CMP} ../pix/star.pix star.pix
|
||||
if test $? = 0
|
||||
then
|
||||
echo star.pix: answers are RIGHT
|
||||
else
|
||||
echo star.pix: WRONG WRONG WRONG WRONG WRONG WRONG
|
||||
fi
|
||||
|
||||
echo +++++ bldg391
|
||||
if test -f bldg391.pix; then mv -f bldg391.pix bldg391.pix.$$; fi
|
||||
if test -f bldg391.log; then mv -f bldg391.log bldg391.log.$$; fi
|
||||
time $RT -B -M -s512 $* \
|
||||
-o bldg391.pix \
|
||||
$DB/bldg391.g all.g \
|
||||
2> bldg391.log \
|
||||
<<EOF
|
||||
viewsize 1.800000000e+03;
|
||||
eye_pt 6.345012207e+02 8.633251343e+02 8.310771484e+02;
|
||||
viewrot -5.735764503e-01 8.191520572e-01 0.000000000e+00
|
||||
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01
|
||||
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
|
||||
1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
${CMP} ../pix/bldg391.pix bldg391.pix
|
||||
if test $? = 0
|
||||
then
|
||||
echo bldg391.pix: answers are RIGHT
|
||||
else
|
||||
echo bldg391.pix: WRONG WRONG WRONG WRONG WRONG WRONG
|
||||
fi
|
||||
|
||||
echo +++++ m35
|
||||
if test -f m35.pix; then mv -f m35.pix m35.pix.$$; fi
|
||||
if test -f m35.log; then mv -f m35.log m35.log.$$; fi
|
||||
time $RT -B -M -s512 $* \
|
||||
-o m35.pix \
|
||||
$DB/m35.g all.g \
|
||||
2> m35.log \
|
||||
<< EOF
|
||||
viewsize 6.787387985e+03;
|
||||
eye_pt 3.974533127e+03 1.503320754e+03 2.874633221e+03;
|
||||
viewrot -5.527838919e-01 8.332423558e-01 1.171090926e-02 0.000000000e+00
|
||||
-4.815587087e-01 -3.308784486e-01 8.115544728e-01 0.000000000e+00
|
||||
6.800964482e-01 4.429747496e-01 5.841593895e-01 0.000000000e+00
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
${CMP} ../pix/m35.pix m35.pix
|
||||
if test $? = 0
|
||||
then
|
||||
echo m35.pix: answers are RIGHT
|
||||
else
|
||||
echo m35.pix: WRONG WRONG WRONG WRONG WRONG WRONG
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Testing complete, check times against reference files in ../pix/.
|
||||
|
||||
if test x$UNIXTYPE = xBSD
|
||||
then HOST=`hostname`
|
||||
else HOST=`uname -n`
|
||||
fi
|
||||
|
||||
sh ../bench/perf.sh "$HOST" "`date`" "$*" >> summary
|
||||
-118
@@ -1,118 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A Shell script to run the BRL-CAD Benchmark Test,
|
||||
# with output going to the current framebuffer, rather than a file.
|
||||
# @(#)$Header$ (BRL)
|
||||
|
||||
# Ensure /bin/sh
|
||||
export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
|
||||
|
||||
eval `machinetype.sh -b` # sets MACHINE, UNIXTYPE, HAS_TCP
|
||||
if test -f ../.rt.$MACHINE/rt
|
||||
then
|
||||
RT=../.rt.$MACHINE/rt
|
||||
DB=../.db.$MACHINE
|
||||
else
|
||||
if test -f ../rt/rt
|
||||
then
|
||||
RT=../rt/rt
|
||||
DB=../db
|
||||
else
|
||||
echo "Can't find RT"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CMP=./pixcmp
|
||||
if test ! -f $CMP
|
||||
then
|
||||
cake pixcmp
|
||||
fi
|
||||
|
||||
# Alliant NFS hack
|
||||
if test x${MACHINE} = xfx
|
||||
then
|
||||
cp ${RT} /tmp/rt
|
||||
cp ${CMP} /tmp/pixcmp
|
||||
RT=/tmp/rt
|
||||
CMP=/tmp/pixcmp
|
||||
fi
|
||||
|
||||
# Run the tests
|
||||
|
||||
echo +++++ moss
|
||||
|
||||
time $RT -B -M -s512 $* \
|
||||
$DB/moss.g all.g \
|
||||
<< EOF
|
||||
viewsize 1.572026215e+02;
|
||||
eye_pt 6.379990387e+01 3.271768951e+01 3.366661453e+01;
|
||||
viewrot -5.735764503e-01 8.191520572e-01 0.000000000e+00
|
||||
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01
|
||||
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
|
||||
1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
|
||||
echo +++++ world
|
||||
|
||||
time $RT -B -M -s512 $* \
|
||||
$DB/world.g all.g \
|
||||
<< EOF
|
||||
viewsize 1.572026215e+02;
|
||||
eye_pt 6.379990387e+01 3.271768951e+01 3.366661453e+01;
|
||||
viewrot -5.735764503e-01 8.191520572e-01 0.000000000e+00
|
||||
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01
|
||||
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
|
||||
1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
|
||||
echo +++++ star
|
||||
|
||||
time $RT -B -M -s512 $* \
|
||||
$DB/star.g all \
|
||||
<<EOF
|
||||
viewsize 2.500000000e+05;
|
||||
eye_pt 2.102677960e+05 8.455500000e+04 2.934714650e+04;
|
||||
viewrot -6.733560560e-01 6.130643360e-01 4.132114880e-01 0.000000000e+00
|
||||
5.539599410e-01 4.823888300e-02 8.311441420e-01 0.000000000e+00
|
||||
4.896120540e-01 7.885590550e-01 -3.720948210e-01 0.000000000e+00
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
|
||||
echo +++++ bldg391
|
||||
|
||||
time $RT -B -M -s512 $* \
|
||||
$DB/bldg391.g all.g \
|
||||
<<EOF
|
||||
viewsize 1.800000000e+03;
|
||||
eye_pt 6.345012207e+02 8.633251343e+02 8.310771484e+02;
|
||||
viewrot -5.735764503e-01 8.191520572e-01 0.000000000e+00
|
||||
0.000000000e+00 -3.461886346e-01 -2.424038798e-01 9.063078165e-01
|
||||
0.000000000e+00 7.424039245e-01 5.198368430e-01 4.226182699e-01
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
|
||||
1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
|
||||
echo +++++ m35
|
||||
|
||||
time $RT -B -M -s512 $* \
|
||||
$DB/m35.g all.g \
|
||||
<< EOF
|
||||
viewsize 6.787387985e+03;
|
||||
eye_pt 3.974533127e+03 1.503320754e+03 2.874633221e+03;
|
||||
viewrot -5.527838919e-01 8.332423558e-01 1.171090926e-02 0.000000000e+00
|
||||
-4.815587087e-01 -3.308784486e-01 8.115544728e-01 0.000000000e+00
|
||||
6.800964482e-01 4.429747496e-01 5.841593895e-01 0.000000000e+00
|
||||
0.000000000e+00 0.000000000e+00 0.000000000e+00 1.000000000e+00 ;
|
||||
start 0;
|
||||
end;
|
||||
EOF
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* burst/Cakefile
|
||||
*
|
||||
* Author: Gary S. Moss
|
||||
* U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground
|
||||
* Maryland 21005-5066
|
||||
* (301)278-6651 or AV-298-6651
|
||||
*
|
||||
* $Header$ (BRL)
|
||||
*
|
||||
* FONTDIR is pathname to font file (times.r.6) which is included with sources
|
||||
* but on real BSD systems is found in /usr/lib/vfont.
|
||||
*/
|
||||
#define CONFIGDEFS LGT_CONFIG -DDEBUG -I.
|
||||
|
||||
#define SRCDIR burst
|
||||
#define PRODUCTS burst
|
||||
#define SRCSUFF .c
|
||||
#define MANSECTION 1
|
||||
#define FILES burst error fb glob grid gridrotate idents\
|
||||
paint plot prnt trie ui
|
||||
#define MYLIBES Hm/libHm.a Sc/libSc.a Tc/libTc.a
|
||||
#include "../Cakefile.defs"
|
||||
#include "../Cakefile.prog"
|
||||
|
||||
/* Explicit composition of each product */
|
||||
|
||||
Hm/libHm.a:
|
||||
cd Hm; make install
|
||||
|
||||
Sc/libSc.a:
|
||||
cd Sc; make install
|
||||
|
||||
Tc/libTc.a:
|
||||
cd Tc; make install
|
||||
|
||||
burst: OBJ MYLIBES
|
||||
CC LDFLAGS -o burst OBJ LIBRT RT_LIBES LIBFB LIBTERMLIB LIBES MYLIBES -ltermlib -lm
|
||||
|
||||
test&: burst
|
||||
./burst < tfiles/ktank.in
|
||||
|
||||
#include "../Cakefile.rules"
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
|
||||
$Header$ (BRL)
|
||||
*/
|
||||
/* Emulate MUVES Mm package using malloc. */
|
||||
#if __STDC__
|
||||
extern char *malloc( unsigned n );
|
||||
extern char *strcpy( char *s1, char *s2 );
|
||||
#else
|
||||
extern char *malloc();
|
||||
extern char *strcpy();
|
||||
#endif
|
||||
#define MmAllo( typ ) (typ *) malloc( sizeof(typ) )
|
||||
#define MmFree( typ, ptr ) free( (char *) ptr )
|
||||
#define MmVAllo( ct, typ ) (typ *) malloc( (ct)*sizeof(typ) )
|
||||
#define MmVFree( ct, typ, ptr ) free( (char *) ptr )
|
||||
#define MmStrDup( str ) strcpy( malloc( strlen(str)+1 ), str )
|
||||
#define MmStrFree( str ) free( str )
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
$Header$
|
||||
*/
|
||||
#define NUL '\000'
|
||||
#define SOH '\001'
|
||||
#define STX '\002'
|
||||
#define INTR '\003'
|
||||
#define EOT '\004'
|
||||
#define ACK '\006'
|
||||
#define BEL '\007'
|
||||
#define BS '\010'
|
||||
#define HT '\011'
|
||||
#define LF '\012'
|
||||
#define FF '\014'
|
||||
#define CR '\015'
|
||||
#define DLE '\020'
|
||||
#define DC1 '\021'
|
||||
#define DC2 '\022'
|
||||
#define DC3 '\023'
|
||||
#define DC4 '\024'
|
||||
#define KILL '\025'
|
||||
#define CAN '\030'
|
||||
#define ESC '\033'
|
||||
#define GS '\035'
|
||||
#define RS '\036'
|
||||
#define US '\037'
|
||||
#define SP '\040'
|
||||
#define DEL '\177'
|
||||
|
||||
#define Ctrl(chr) ((int)chr&037)
|
||||
-264
@@ -1,264 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
#define NDEBUG
|
||||
#define STATIC static
|
||||
#else
|
||||
#define STATIC
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "./burst.h"
|
||||
#include "./trie.h"
|
||||
#include "./ascii.h"
|
||||
#include "./extern.h"
|
||||
|
||||
#define DEBUG_BURST 0 /* 1 enables debugging for this module */
|
||||
|
||||
/*
|
||||
bool getCommand( char *name, char *buf, int len, FILE *fp )
|
||||
|
||||
Read next command line into buf and stuff the command name into name
|
||||
from input stream fp. buf must be at least len bytes long.
|
||||
|
||||
RETURN: true for success
|
||||
|
||||
false for end of file
|
||||
*/
|
||||
STATIC bool
|
||||
#if STD_C
|
||||
getCommand( char *name, char *buf, int len, FILE *fp )
|
||||
#else
|
||||
getCommand( name, buf, len, fp )
|
||||
char *name;
|
||||
char *buf;
|
||||
int len;
|
||||
FILE *fp;
|
||||
#endif
|
||||
{
|
||||
assert( name != NULL );
|
||||
assert( buf != NULL );
|
||||
assert( fp != NULL );
|
||||
while( fgets( buf, len, fp ) != NULL )
|
||||
{
|
||||
if( buf[0] != CHAR_COMMENT )
|
||||
{
|
||||
if( sscanf( buf, "%s", name ) == 1 )
|
||||
{
|
||||
buf[strlen(buf)-1] = NUL; /* clobber newline */
|
||||
return true;
|
||||
}
|
||||
else /* Skip over blank lines. */
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ /* Generate comment command. */
|
||||
(void) strcpy( name, CMD_COMMENT );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false; /* EOF */
|
||||
}
|
||||
|
||||
/*
|
||||
void setupSigs( void )
|
||||
|
||||
Initialize all signal handlers.
|
||||
*/
|
||||
STATIC void
|
||||
#if STD_C
|
||||
setupSigs( void )
|
||||
#else
|
||||
setupSigs()
|
||||
#endif
|
||||
{ register int i;
|
||||
for( i = 0; i < NSIG; i++ )
|
||||
switch( i )
|
||||
{
|
||||
case SIGINT :
|
||||
if( (norml_sig = signal( i, SIG_IGN )) == SIG_IGN )
|
||||
abort_sig = SIG_IGN;
|
||||
else
|
||||
{
|
||||
norml_sig = intr_sig;
|
||||
abort_sig = abort_RT;
|
||||
(void) signal( i, norml_sig );
|
||||
}
|
||||
break;
|
||||
#if defined( BSD )
|
||||
case SIGCHLD :
|
||||
#else
|
||||
case SIGCLD :
|
||||
#endif
|
||||
break; /* leave SIGCLD alone */
|
||||
case SIGPIPE :
|
||||
(void) signal( i, SIG_IGN );
|
||||
break;
|
||||
case SIGQUIT :
|
||||
break;
|
||||
#if ! defined( SYSV )
|
||||
#if ! defined( SIGTSTP )
|
||||
#define SIGTSTP 18
|
||||
#endif
|
||||
case SIGTSTP :
|
||||
(void) signal( i, stop_sig );
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
int parsArgv( int argc, char **argv )
|
||||
|
||||
Parse program command line.
|
||||
*/
|
||||
STATIC int
|
||||
#if STD_C
|
||||
parsArgv( int argc, char **argv )
|
||||
#else
|
||||
parsArgv( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
#endif
|
||||
{ register int c;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
/* Parse options. */
|
||||
while( (c = getopt( argc, argv, "b" )) != EOF )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
case 'b' :
|
||||
tty = false;
|
||||
break;
|
||||
case '?' :
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
void readBatchInput( FILE *fp )
|
||||
|
||||
Read and execute commands from input stream fp.
|
||||
*/
|
||||
void
|
||||
#if STD_C
|
||||
readBatchInput( FILE *fp )
|
||||
#else
|
||||
readBatchInput( fp )
|
||||
FILE *fp;
|
||||
#endif
|
||||
{
|
||||
assert( fp != (FILE *) NULL );
|
||||
batchmode = true;
|
||||
while( getCommand( cmdname, cmdbuf, LNBUFSZ, fp ) )
|
||||
{ Func *cmdfunc;
|
||||
if( (cmdfunc = getTrie( cmdname, cmdtrie )) == NULL )
|
||||
{ register int i, len = strlen( cmdname );
|
||||
rt_log( "ERROR -- command syntax:\n" );
|
||||
rt_log( "\t%s\n", cmdbuf );
|
||||
rt_log( "\t" );
|
||||
for( i = 0; i < len; i++ )
|
||||
rt_log( " " );
|
||||
rt_log( "^\n" );
|
||||
}
|
||||
else
|
||||
if( strcmp( cmdname, CMD_COMMENT ) == 0 )
|
||||
{ /* special handling for comments */
|
||||
cmdptr = cmdbuf;
|
||||
(*cmdfunc)( (HmItem *) 0 );
|
||||
}
|
||||
else
|
||||
{ /* Advance pointer past nul at end of
|
||||
command name. */
|
||||
cmdptr = cmdbuf + strlen( cmdname ) + 1;
|
||||
(*cmdfunc)( (HmItem *) 0 );
|
||||
}
|
||||
}
|
||||
batchmode = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
int main( int argc, char *argv[] )
|
||||
*/
|
||||
STATIC int
|
||||
#if STD_C
|
||||
main( int argc, char *argv[] )
|
||||
#else
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char *argv[];
|
||||
#endif
|
||||
{
|
||||
#if ! defined( BSD ) && ! defined( sgi )
|
||||
setvbuf( stderr, (char *) NULL, _IOLBF, BUFSIZ );
|
||||
#endif
|
||||
if( tmpnam( tmpfname ) == NULL
|
||||
|| (tmpfp = fopen( tmpfname, "w" )) == (FILE *) NULL
|
||||
)
|
||||
{
|
||||
perror( tmpfname );
|
||||
(void) fprintf( stderr,
|
||||
"Write access denied for file (%s).\n",
|
||||
tmpfname );
|
||||
goto death;
|
||||
}
|
||||
if( ! parsArgv( argc, argv ) )
|
||||
{
|
||||
prntUsage();
|
||||
goto clean;
|
||||
}
|
||||
|
||||
setupSigs();
|
||||
if( ! initUi() ) /* must be called before any output is produced */
|
||||
goto clean;
|
||||
|
||||
#if DEBUG_BURST
|
||||
prntTrie( cmdtrie, 0 );
|
||||
#endif
|
||||
if( ! isatty( 0 ) || ! tty )
|
||||
readBatchInput( stdin );
|
||||
if( tty )
|
||||
(void) HmHit( mainhmenu );
|
||||
exitCleanly( EXIT_SUCCESS );
|
||||
clean: (void) unlink( tmpfname );
|
||||
death: return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
void exitCleanly( int code )
|
||||
|
||||
Should be only exit from program after success of initUi().
|
||||
*/
|
||||
void
|
||||
#if STD_C
|
||||
exitCleanly( int code )
|
||||
#else
|
||||
exitCleanly( code )
|
||||
int code;
|
||||
#endif
|
||||
{
|
||||
if( tty )
|
||||
closeUi(); /* keep screen straight */
|
||||
(void) fclose( tmpfp );
|
||||
if( unlink( tmpfname ) == -1 )
|
||||
locPerror( tmpfname );
|
||||
exit( code );
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
Shotline file output format from burst program:
|
||||
|
||||
record type: 1
|
||||
description: header line for each aspect
|
||||
ICD reference: Line Number 1, Figure 19.
|
||||
format: '1',2(1x,f8.4),5(1x,f7.2),1x,6a
|
||||
data: attack azimuth in degrees
|
||||
attack elevation in degrees
|
||||
shotline separation
|
||||
maximum Y'-coordinate of target
|
||||
minimum Y'-coordinate of target
|
||||
maximum Z'-coordinate of target
|
||||
minimum Z'-coordinate of target
|
||||
units (mm,cm,inches,feet,meters)
|
||||
|
||||
record type: 2
|
||||
description: information about shotline
|
||||
format: '2',2(1x,f8.2)
|
||||
data: horizontal coordinate of shotline in grid plane (Y')
|
||||
vertical coordinate of shotline in grid plane (Z')
|
||||
|
||||
record type: 3
|
||||
description: information about component intersected by shotline
|
||||
format: '3',1x,f8.2,2(1x,f7.3),1x,i4,2(1x,f8.2),1x,i2,2(1x,f7.2)
|
||||
data: distance to first contact with component (X' of intersection)
|
||||
sine of fallback angle of component entry normal
|
||||
rotation angle in degrees of entry normal
|
||||
component code number
|
||||
normal thickness of component
|
||||
line-of-sight thickness of component
|
||||
space code following component
|
||||
obliquity angle at entry to component in degrees
|
||||
obliquity angle at exit from component in degrees
|
||||
|
||||
Burst Point Library output format from burst program:
|
||||
|
||||
record type: 1
|
||||
description: header line for each aspect
|
||||
ICD reference: Line Number 1, Figure 20.
|
||||
format: '1',2(1x,f8.4),1x,f4.1,1x,f10.2,1x,6a
|
||||
data: attack azimuth in degrees
|
||||
attack elevation in degrees
|
||||
burst distance
|
||||
projected area associated with burst point
|
||||
units (mm,cm,inches,feet,meters)
|
||||
|
||||
record type: 2
|
||||
description: information about shotline
|
||||
ICD reference: Line Number 2, Figure 20.
|
||||
format: '2',2(1x,f8.2)
|
||||
data: horizontal coordinate of shotline in grid plane (Y')
|
||||
vertical coordinate of shotline in grid plane (Z')
|
||||
|
||||
record type: 3
|
||||
description: information about component intersected by shotline
|
||||
ICD reference: Line Number 3, Figure 20.
|
||||
format: '3',2(1x,f8.2),1x,i4,1x,i2,3(1x,f7.3)
|
||||
data: distance to first contact with component (X' of intersection)
|
||||
line-of-sight thickness of component
|
||||
component code number
|
||||
space code
|
||||
sine of fallback angle of component entry normal
|
||||
rotation angle in degrees of component entry normal
|
||||
cosine of obliquity angle at entry to component
|
||||
|
||||
record type: 4
|
||||
description: information about burst ray
|
||||
ICD reference: Line Number 19, Figure 20.
|
||||
format: '4',2(1x,f6.3),1x,i6
|
||||
data: ray azimuth angle WRT shotline in radians
|
||||
sine of ray elevation angle WRT shotline
|
||||
sequential ray number for this burst point
|
||||
|
||||
record type: 5
|
||||
description: information about component intersected by burst ray
|
||||
ICD reference: Line Number 20, Figure 20.
|
||||
format: '5',1x,f10.3,2(1x,f9.3),2(1x,i4),1x,f6.3
|
||||
data: distance to first contact with component from burst point
|
||||
line-of-sight thickness of component
|
||||
normal thickness of component
|
||||
space code
|
||||
component code number
|
||||
cosine of obliquity angle at entry
|
||||
-264
@@ -1,264 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
|
||||
$Header$ (BRL)
|
||||
*/
|
||||
#ifndef INCL_BURST
|
||||
#define INCL_BURST
|
||||
|
||||
/* Some useful stuff from Doug Gwyn's std.h. */
|
||||
/* Extended data types */
|
||||
typedef int bool; /* Boolean data */
|
||||
#define false 0
|
||||
#define true 1
|
||||
/* ANSI C definitions */
|
||||
/* Defense against some silly systems defining __STDC__ to random things. */
|
||||
#ifdef STD_C
|
||||
#undef STD_C
|
||||
#endif
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ > 0
|
||||
#define STD_C __STDC__ /* use this instead of __STDC__ */
|
||||
#endif
|
||||
#endif
|
||||
#if STD_C
|
||||
typedef void *pointer; /* generic pointer */
|
||||
#else
|
||||
typedef char *pointer; /* generic pointer */
|
||||
#define const /* nothing */ /* ANSI C type qualifier */
|
||||
/* There really is no substitute for the following, but these might work: */
|
||||
#define signed /* nothing */ /* ANSI C type specifier */
|
||||
#define volatile /* nothing */ /* ANSI C type qualifier */
|
||||
#endif
|
||||
#ifndef EXIT_SUCCESS
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
#define DEGRAD 57.2957795130823208767981548141051703324054724665642
|
||||
|
||||
/* allow for SGI screw-up, the single-precision math libraries */
|
||||
#if defined( sgi ) && ! defined( mips )
|
||||
#define SINGLE_PRECISION 1
|
||||
#else
|
||||
#define SINGLE_PRECISION 0
|
||||
#endif
|
||||
|
||||
/* allow for SGI screw-up, winclose() dumps core on some systems */
|
||||
#if defined(SGI4D_Rel2)
|
||||
#define SGI_WINCLOSE_BUG 1
|
||||
#else
|
||||
#define SGI_WINCLOSE_BUG 0
|
||||
#endif
|
||||
|
||||
/* allow for BSD screw-up, declaring signal handlers as 'int' functions */
|
||||
#if STD_C || (defined(SYSV) && ! defined(cray))
|
||||
#define STD_SIGNAL_DECLS 1
|
||||
#else
|
||||
#define STD_SIGNAL_DECLS 0
|
||||
#endif
|
||||
|
||||
/* menu configuration */
|
||||
#define MENU_LFT 1
|
||||
#define MENU_TOP 2
|
||||
#define MENU_MAXVISITEMS 10
|
||||
|
||||
/* prompt line configuration */
|
||||
#define PROMPT_X HmXPROMPT
|
||||
#define PROMPT_Y HmYPROMPT
|
||||
|
||||
/* banner (border) configuration */
|
||||
#define BORDER_CHR '_'
|
||||
#define BORDER_Y (PROMPT_Y+1)
|
||||
|
||||
/* grid offset printing window */
|
||||
#define GRID_X 55 /* where grid indices are printed */
|
||||
#define GRID_Y BORDER_Y
|
||||
|
||||
/* scroll region configuration */
|
||||
#define SCROLL_TOP (BORDER_Y+1)
|
||||
#define SCROLL_BTM (ScLI-1) /* bottom line causes scroll */
|
||||
|
||||
/* timer (cpu statistics) window configuration */
|
||||
#define TIMER_X 1
|
||||
#define TIMER_Y 1
|
||||
|
||||
/* buffer sizes */
|
||||
#define LNBUFSZ 133 /* buffer for one-line messages */
|
||||
#define MAXDEVWID 1024 /* maximum width of frame buffer */
|
||||
|
||||
#define CHAR_COMMENT '#'
|
||||
#define CMD_COMMENT "comment"
|
||||
|
||||
/* default parameters */
|
||||
#define DFL_AZIMUTH 0.0
|
||||
#define DFL_BARRIERS 100
|
||||
#define DFL_BDIST 0.0
|
||||
#define DFL_CELLSIZE 101.6
|
||||
#define DFL_CONEANGLE (45.0/DEGRAD)
|
||||
#define DFL_DEFLECT false
|
||||
#define DFL_DITHER false
|
||||
#define DFL_ELEVATION 0.0
|
||||
#define DFL_NRAYS 200
|
||||
#define DFL_OVERLAPS true
|
||||
#define DFL_RIPLEVELS 1
|
||||
#define DFL_UNITS U_MILLIMETERS
|
||||
|
||||
/* firing mode bit definitions */
|
||||
#define ASNBIT(w,b) (w = (b))
|
||||
#define SETBIT(w,b) (w |= (b))
|
||||
#define CLRBIT(w,b) (w &= ~(b))
|
||||
#define TSTBIT(w,b) ((w)&(b))
|
||||
#define FM_GRID 0 /* generate grid of shotlines */
|
||||
#define FM_DFLT FM_GRID
|
||||
#define FM_PART (1) /* bit 0: ON = partial envelope, OFF = full */
|
||||
#define FM_SHOT (1<<1) /* bit 1: ON = discrete shots, OFF = gridding */
|
||||
#define FM_FILE (1<<2) /* bit 2: ON = file input, OFF = direct input */
|
||||
#define FM_3DIM (1<<3) /* bit 3: ON = 3-D coords., OFF = 2-D coords */
|
||||
#define FM_BURST (1<<4) /* bit 4: ON = discrete burst points, OFF = shots */
|
||||
|
||||
/* flags for notify() */
|
||||
#define NOTIFY_APPEND 1
|
||||
#define NOTIFY_DELETE 2
|
||||
#define NOTIFY_ERASE 4
|
||||
|
||||
#define NOTIFY_DELIM ':'
|
||||
|
||||
#define PB_ASPECT_INIT '1'
|
||||
#define PB_CELL_IDENT '2'
|
||||
#define PB_RAY_INTERSECT '3'
|
||||
#define PB_RAY_HEADER '4'
|
||||
#define PB_REGION_HEADER '5'
|
||||
|
||||
#define PS_ASPECT_INIT '1'
|
||||
#define PS_CELL_IDENT '2'
|
||||
#define PS_SHOT_INTERSECT '3'
|
||||
|
||||
#define TITLE_LEN 72
|
||||
#define TIMER_LEN 72
|
||||
|
||||
#define U_INCHES 0
|
||||
#define U_FEET 1
|
||||
#define U_MILLIMETERS 2
|
||||
#define U_CENTIMETERS 3
|
||||
#define U_METERS 4
|
||||
#define U_BAD -1
|
||||
|
||||
#define UNITS_INCHES "inches"
|
||||
#define UNITS_FEET "feet"
|
||||
#define UNITS_MILLIMETERS "millimeters"
|
||||
#define UNITS_CENTIMETERS "centimeters"
|
||||
#define UNITS_METERS "meters"
|
||||
|
||||
/* white space in input tokens */
|
||||
#define WHITESPACE " \t"
|
||||
|
||||
#define R_OUTAIR 100
|
||||
#define G_OUTAIR 100
|
||||
#define B_OUTAIR 255
|
||||
#define R_INAIR 100
|
||||
#define G_INAIR 255
|
||||
#define B_INAIR 100
|
||||
#define R_COMP 0
|
||||
#define G_COMP 0
|
||||
#define B_COMP 255
|
||||
#define R_CRIT 255
|
||||
#define G_CRIT 0
|
||||
#define B_CRIT 255
|
||||
#define R_SHIELD 255
|
||||
#define G_SHIELD 255
|
||||
#define B_SHIELD 255
|
||||
|
||||
#define C_MAIN 0
|
||||
#define C_CRIT 1
|
||||
#define C_SHIELD 2
|
||||
|
||||
#define TWO_PI 6.28318530717958647692528676655900576839433879875022
|
||||
|
||||
#define COS_TOL 0.01
|
||||
#define LOS_TOL 0.1
|
||||
#define VEC_TOL 0.001
|
||||
#define OVERLAP_TOL 0.25 /* thinner overlaps not reported */
|
||||
#define EXIT_AIR 9 /* exit air is called 09 air */
|
||||
#define OUTSIDE_AIR 1 /* outside air is called 01 air */
|
||||
|
||||
#define Air(rp) ((rp)->reg_aircode > 0)
|
||||
#define DiffAir(rp,sp) ((rp)->reg_aircode != (sp)->reg_aircode)
|
||||
#define SameAir(rp,sp) ((rp)->reg_aircode == (sp)->reg_aircode)
|
||||
#define SameCmp(rp,sp) ((rp)->reg_regionid == (sp)->reg_regionid)
|
||||
#define OutsideAir(rp) ((rp)->reg_aircode == OUTSIDE_AIR)
|
||||
#define InsideAir(rp) (Air(rp)&& !OutsideAir(rp))
|
||||
|
||||
#define Check_Iflip( _pp, _normal, _rdir )\
|
||||
{ fastf_t f;\
|
||||
if( _pp->pt_inflip )\
|
||||
{\
|
||||
ScaleVec( _normal, -1.0 );\
|
||||
_pp->pt_inflip = 0;\
|
||||
}\
|
||||
f = Dot( _rdir, _normal );\
|
||||
if( f >= 0.0 )\
|
||||
{\
|
||||
ScaleVec( _normal, -1.0 );\
|
||||
rt_log( "Fixed flipped entry normal\n" );\
|
||||
}\
|
||||
}
|
||||
#define Check_Oflip( _pp, _normal, _rdir )\
|
||||
{ fastf_t f;\
|
||||
if( _pp->pt_outflip )\
|
||||
{\
|
||||
ScaleVec( _normal, -1.0 );\
|
||||
_pp->pt_outflip = 0;\
|
||||
}\
|
||||
f = Dot( _rdir, _normal );\
|
||||
if( f <= 0.0 )\
|
||||
{\
|
||||
ScaleVec( _normal, -1.0 );\
|
||||
rt_log( "Fixed flipped exit normal\n" );\
|
||||
}\
|
||||
}
|
||||
|
||||
#define Malloc_Bomb( _bytes_ ) \
|
||||
rt_log( "\"%s\"(%d) : allocation of %d bytes failed.\n",\
|
||||
__FILE__, __LINE__, _bytes_ )
|
||||
|
||||
#define Swap_Doubles( a_, b_ ) \
|
||||
{ fastf_t f_ = a_; \
|
||||
a_ = b_; \
|
||||
b_ = f_; \
|
||||
}
|
||||
#define Toggle(f) (f) = !(f)
|
||||
|
||||
typedef struct ids Ids;
|
||||
struct ids
|
||||
{
|
||||
short i_lower;
|
||||
short i_upper;
|
||||
Ids *i_next;
|
||||
};
|
||||
#define IDS_NULL (Ids *) 0
|
||||
|
||||
typedef struct colors Colors;
|
||||
struct colors
|
||||
{
|
||||
short c_lower;
|
||||
short c_upper;
|
||||
unsigned char c_rgb[3];
|
||||
Colors *c_next;
|
||||
};
|
||||
#define COLORS_NULL (Colors *) 0
|
||||
|
||||
typedef struct pt_queue Pt_Queue;
|
||||
struct pt_queue
|
||||
{
|
||||
struct partition *q_part;
|
||||
Pt_Queue *q_next;
|
||||
};
|
||||
|
||||
#define PT_Q_NULL (Pt_Queue *) 0
|
||||
#endif /* INCL_BURST */
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
/*
|
||||
* E R R O R
|
||||
*
|
||||
* Ray Tracing library and Framebuffer library, error handling routines.
|
||||
*
|
||||
* Functions -
|
||||
* rt_bomb Called upon fatal RT library error.
|
||||
* rt_log Called to log RT library events.
|
||||
* fb_log Called to log FB library events.
|
||||
*
|
||||
* Idea originated by Mike John Muuss
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <varargs.h>
|
||||
#include <Sc/Sc.h>
|
||||
#include "./extern.h"
|
||||
|
||||
/*
|
||||
* R T _ B O M B
|
||||
*
|
||||
* Abort the RT library
|
||||
*/
|
||||
void
|
||||
rt_bomb(str)
|
||||
char *str;
|
||||
{
|
||||
rt_log( "%s (librt.a) : Fatal error, aborting!\n", str );
|
||||
(void) fflush( stdout );
|
||||
(void) abort(); /* Should dump. */
|
||||
exit(12);
|
||||
}
|
||||
|
||||
/*
|
||||
* R T _ L O G
|
||||
*
|
||||
* Log an RT library event
|
||||
*/
|
||||
/* VARARGS */
|
||||
void
|
||||
rt_log( fmt, va_alist )
|
||||
char *fmt;
|
||||
va_dcl
|
||||
{ va_list ap;
|
||||
va_start( ap );
|
||||
if( tty && (errfile[0] == '\0' || ! strcmp( errfile, "/dev/tty" )) )
|
||||
{
|
||||
if( ScSetScrlReg( SCROLL_TOP, SCROLL_BTM ) )
|
||||
{
|
||||
(void) ScMvCursor( 1, SCROLL_BTM );
|
||||
(void) ScClrEOL();
|
||||
(void) _doprnt( fmt, ap, stdout );
|
||||
(void) ScClrScrlReg();
|
||||
}
|
||||
else
|
||||
if( ScDL != NULL )
|
||||
{
|
||||
(void) ScMvCursor( 1, SCROLL_TOP );
|
||||
(void) ScDeleteLn();
|
||||
(void) ScMvCursor( 1, SCROLL_BTM );
|
||||
(void) ScClrEOL();
|
||||
(void) _doprnt( fmt, ap, stdout );
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) _doprnt( fmt, ap, stdout );
|
||||
}
|
||||
(void) fflush( stdout );
|
||||
}
|
||||
else
|
||||
(void) _doprnt( fmt, ap, stderr );
|
||||
va_end( ap );
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* F B _ L O G
|
||||
*
|
||||
* Log an FB library event
|
||||
*/
|
||||
/* VARARGS */
|
||||
void
|
||||
fb_log( fmt, va_alist )
|
||||
char *fmt;
|
||||
va_dcl
|
||||
{
|
||||
(void) rt_log( fmt, va_alist );
|
||||
return;
|
||||
}
|
||||
-214
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
|
||||
$Header$ (BRL)
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "machine.h"
|
||||
#include "fb.h"
|
||||
|
||||
#include "./burst.h"
|
||||
#include "./trie.h"
|
||||
#include "Hm/Hm.h"
|
||||
|
||||
/* External functions from C library. */
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
extern pointer sbrk( int );
|
||||
#else
|
||||
extern char *fgets();
|
||||
extern char *getenv();
|
||||
extern char *malloc();
|
||||
extern char *tmpnam();
|
||||
extern pointer sbrk();
|
||||
#endif
|
||||
#ifdef SYSV
|
||||
extern long lrand48();
|
||||
#else
|
||||
extern long random();
|
||||
#endif
|
||||
|
||||
/* External variables from termlib. */
|
||||
extern char *CS, *DL;
|
||||
extern int CO, LI;
|
||||
|
||||
/* External functions from application. */
|
||||
extern Colors *findColors();
|
||||
extern Func *getTrie();
|
||||
extern Trie *addTrie();
|
||||
extern bool closFbDevice();
|
||||
extern bool imageInit();
|
||||
extern bool initUi();
|
||||
extern bool openFbDevice();
|
||||
extern bool findIdents();
|
||||
extern bool readColors();
|
||||
extern bool readIdents();
|
||||
extern int notify();
|
||||
extern int round();
|
||||
extern void closeUi();
|
||||
extern void colorPartition();
|
||||
extern void exitCleanly();
|
||||
extern void gridInit();
|
||||
extern void gridModel();
|
||||
extern void gridToFb();
|
||||
extern void locPerror();
|
||||
extern void logCmd();
|
||||
extern void paintCellFb();
|
||||
extern void paintGridFb();
|
||||
extern void paintSpallFb();
|
||||
extern void plotGrid();
|
||||
extern void plotInit();
|
||||
extern void plotPartition();
|
||||
extern void plotRay();
|
||||
extern void plotShieldComp();
|
||||
extern void prntAspectInit();
|
||||
extern void prntBurstHdr();
|
||||
extern void prntCellIdent();
|
||||
extern void prntFiringCoords();
|
||||
extern void prntFusingComp();
|
||||
extern void prntGridOffsets();
|
||||
extern void prntIdents();
|
||||
extern void prntPhantom();
|
||||
extern void prntRayHeader();
|
||||
extern void prntRayIntersect();
|
||||
extern void prntScr();
|
||||
extern void prntTimer();
|
||||
extern void prompt();
|
||||
extern void readCmdFile();
|
||||
extern void rt_log();
|
||||
extern void warning();
|
||||
|
||||
#if STD_SIGNAL_DECLS
|
||||
extern void (*norml_sig)(), (*abort_sig)();
|
||||
extern void abort_RT();
|
||||
extern void intr_sig();
|
||||
extern void stop_sig();
|
||||
#else
|
||||
extern int (*norml_sig)(), (*abort_sig)();
|
||||
extern int abort_RT();
|
||||
extern int intr_sig();
|
||||
extern int stop_sig();
|
||||
#endif
|
||||
|
||||
extern Colors colorids;
|
||||
extern FBIO *fbiop;
|
||||
extern FILE *burstfp;
|
||||
extern FILE *gridfp;
|
||||
extern FILE *histfp;
|
||||
extern FILE *outfp;
|
||||
extern FILE *plotfp;
|
||||
extern FILE *shotfp;
|
||||
extern FILE *shotlnfp;
|
||||
extern FILE *tmpfp;
|
||||
extern HmMenu *mainhmenu;
|
||||
extern Ids airids;
|
||||
extern Ids armorids;
|
||||
extern Ids critids;
|
||||
extern RGBpixel *pixgrid;
|
||||
extern RGBpixel pixaxis;
|
||||
extern RGBpixel pixbkgr;
|
||||
extern RGBpixel pixbhit;
|
||||
extern RGBpixel pixblack;
|
||||
extern RGBpixel pixcrit;
|
||||
extern RGBpixel pixghit;
|
||||
extern RGBpixel pixmiss;
|
||||
extern RGBpixel pixtarg;
|
||||
extern Trie *cmdtrie;
|
||||
|
||||
extern bool batchmode;
|
||||
extern bool cantwarhead;
|
||||
extern bool deflectcone;
|
||||
extern bool dithercells;
|
||||
extern bool fatalerror;
|
||||
extern bool groundburst;
|
||||
extern bool reportoverlaps;
|
||||
extern bool tty;
|
||||
extern bool userinterrupt;
|
||||
|
||||
extern char airfile[];
|
||||
extern char armorfile[];
|
||||
extern char burstfile[];
|
||||
extern char cmdbuf[];
|
||||
extern char cmdname[];
|
||||
extern char colorfile[];
|
||||
extern char critfile[];
|
||||
extern char errfile[];
|
||||
extern char fbfile[];
|
||||
extern char gedfile[];
|
||||
extern char gridfile[];
|
||||
extern char histfile[];
|
||||
extern char objects[];
|
||||
extern char outfile[];
|
||||
extern char plotfile[];
|
||||
extern char scrbuf[];
|
||||
extern char scriptfile[];
|
||||
extern char shotfile[];
|
||||
extern char shotlnfile[];
|
||||
extern char title[];
|
||||
extern char timer[];
|
||||
extern char tmpfname[];
|
||||
|
||||
extern char *cmdptr;
|
||||
|
||||
extern char **template;
|
||||
|
||||
extern fastf_t bdist;
|
||||
extern fastf_t burstpoint[];
|
||||
extern fastf_t cellsz;
|
||||
extern fastf_t conehfangle;
|
||||
extern fastf_t fire[];
|
||||
extern fastf_t griddn;
|
||||
extern fastf_t gridlf;
|
||||
extern fastf_t gridrt;
|
||||
extern fastf_t gridup;
|
||||
extern fastf_t gridhor[];
|
||||
extern fastf_t gridsoff[];
|
||||
extern fastf_t gridver[];
|
||||
extern fastf_t grndbk;
|
||||
extern fastf_t grndht;
|
||||
extern fastf_t grndfr;
|
||||
extern fastf_t grndlf;
|
||||
extern fastf_t grndrt;
|
||||
extern fastf_t modlcntr[];
|
||||
extern fastf_t modldn;
|
||||
extern fastf_t modllf;
|
||||
extern fastf_t modlrt;
|
||||
extern fastf_t modlup;
|
||||
extern fastf_t pitch;
|
||||
extern fastf_t raysolidangle;
|
||||
extern fastf_t standoff;
|
||||
extern fastf_t unitconv;
|
||||
extern fastf_t viewazim;
|
||||
extern fastf_t viewelev;
|
||||
extern fastf_t viewsize;
|
||||
extern fastf_t yaw;
|
||||
extern fastf_t xaxis[];
|
||||
extern fastf_t zaxis[];
|
||||
extern fastf_t negzaxis[];
|
||||
|
||||
extern int co;
|
||||
extern int devhgt;
|
||||
extern int devwid;
|
||||
extern int firemode;
|
||||
extern int gridsz;
|
||||
extern int gridxfin;
|
||||
extern int gridyfin;
|
||||
extern int gridxorg;
|
||||
extern int gridyorg;
|
||||
extern int gridheight;
|
||||
extern int gridwidth;
|
||||
extern int li;
|
||||
extern int nbarriers;
|
||||
extern int noverlaps;
|
||||
extern int nprocessors;
|
||||
extern int nriplevels;
|
||||
extern int nspallrays;
|
||||
extern int units;
|
||||
extern int zoom;
|
||||
|
||||
extern struct rt_i *rtip;
|
||||
-127
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include "fb.h"
|
||||
#include "./burst.h"
|
||||
#include "./ascii.h"
|
||||
#include "./extern.h"
|
||||
|
||||
bool
|
||||
imageInit()
|
||||
{
|
||||
devwid = 512;
|
||||
devhgt = 512;
|
||||
if( fbfile[0] == NUL )
|
||||
return true;
|
||||
zoom = devwid / gridsz - 1;
|
||||
while( zoom < 3 && devwid < MAXDEVWID )
|
||||
{
|
||||
devwid *= 2;
|
||||
devhgt *= 2;
|
||||
zoom = devwid / gridsz;
|
||||
}
|
||||
if( zoom * gridsz == devwid )
|
||||
zoom--;
|
||||
if( zoom < 1 )
|
||||
zoom = 1;
|
||||
if( fbiop == FBIO_NULL || fb_getwidth( fbiop ) != devwid )
|
||||
{
|
||||
if( ! openFbDevice( fbfile ) )
|
||||
return false;
|
||||
paintGridFb();
|
||||
}
|
||||
else
|
||||
if( !(firemode & FM_SHOT) || (firemode & FM_FILE) )
|
||||
paintGridFb();
|
||||
return true;
|
||||
}
|
||||
|
||||
/* openFbDevice( char *devname )
|
||||
|
||||
Must be called after gridInit() so that gridsz is setup.
|
||||
*/
|
||||
bool
|
||||
openFbDevice( devname )
|
||||
char *devname;
|
||||
{ bool ret = true;
|
||||
notify( "Opening frame buffer", NOTIFY_APPEND );
|
||||
if( zoom < 1 )
|
||||
{
|
||||
prntScr( "Device is too small to display image." );
|
||||
ret = false;
|
||||
goto safe_exit;
|
||||
}
|
||||
if( ( (fbiop != FBIO_NULL && fb_getwidth( fbiop ) != devwid)
|
||||
|| pixgrid == NULL
|
||||
)
|
||||
&& (pixgrid = (RGBpixel *) malloc( sizeof(RGBpixel)*devwid ))
|
||||
== (RGBpixel *) NULL )
|
||||
{
|
||||
prntScr( "Memory allocation of %d bytes failed.",
|
||||
sizeof(RGBpixel)*devwid );
|
||||
ret = false;
|
||||
goto safe_exit;
|
||||
}
|
||||
(void) memset( (char *) pixgrid, NUL, sizeof(RGBpixel)*devwid );
|
||||
if( fbiop != FBIO_NULL )
|
||||
{
|
||||
#if SGI_WINCLOSE_BUG
|
||||
if( strncmp( fbiop->if_name, "/dev/sgi", 8 ) == 0 )
|
||||
{
|
||||
prntScr( "IRIS can't change window size." );
|
||||
ret = false;
|
||||
goto safe_exit;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if( ! closFbDevice() )
|
||||
{
|
||||
ret = false;
|
||||
goto safe_exit;
|
||||
}
|
||||
|
||||
}
|
||||
if( (fbiop = fb_open( devname, devwid, devhgt )) == NULL )
|
||||
{
|
||||
ret = false;
|
||||
goto safe_exit;
|
||||
}
|
||||
else
|
||||
if( fb_clear( fbiop, pixblack ) == -1
|
||||
|| notify( "Zooming", NOTIFY_APPEND ),
|
||||
fb_zoom( fbiop, 1, 1 ) == -1
|
||||
|| notify( "Windowing", NOTIFY_DELETE ),
|
||||
fb_window( fbiop, devwid/2, devhgt/2 ) == -1
|
||||
)
|
||||
{
|
||||
ret = false;
|
||||
goto safe_exit;
|
||||
}
|
||||
safe_exit : notify( NULL, NOTIFY_DELETE );
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
closFbDevice()
|
||||
{ int ret;
|
||||
notify( "Closing frame buffer", NOTIFY_APPEND );
|
||||
if( fb_close( fbiop ) == -1 )
|
||||
ret = false;
|
||||
else
|
||||
{
|
||||
ret = true;
|
||||
fbiop = FBIO_NULL;
|
||||
}
|
||||
notify( NULL, NOTIFY_DELETE );
|
||||
return ret;
|
||||
}
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "fb.h"
|
||||
#include "raytrace.h"
|
||||
#include "./burst.h"
|
||||
#include "./extern.h"
|
||||
|
||||
Colors colorids; /* ident range to color mappings for plots */
|
||||
FBIO *fbiop = NULL; /* frame buffer specific access from libfb */
|
||||
FILE *burstfp = NULL; /* input stream for burst point locations */
|
||||
FILE *gridfp = NULL; /* grid file output stream (2-d shots) */
|
||||
FILE *histfp = NULL; /* histogram output stream (statistics) */
|
||||
FILE *outfp = NULL; /* burst point library output stream */
|
||||
FILE *plotfp = NULL; /* 3-D UNIX plot stream (debugging) */
|
||||
FILE *shotfp = NULL; /* input stream for shot positions */
|
||||
FILE *shotlnfp = NULL; /* shotline file output stream */
|
||||
FILE *tmpfp = NULL; /* temporary file output stream for logging input */
|
||||
HmMenu *mainhmenu;
|
||||
Ids airids; /* burst air idents */
|
||||
Ids armorids; /* burst armor idents */
|
||||
Ids critids; /* critical component idents */
|
||||
RGBpixel *pixgrid;
|
||||
RGBpixel pixaxis = { 255, 0, 0 }; /* grid axis */
|
||||
RGBpixel pixbhit = { 200, 255, 200 }; /* burst ray hit non-critical comps */
|
||||
RGBpixel pixbkgr = { 150, 100, 255 }; /* outside grid */
|
||||
RGBpixel pixblack = { 0, 0, 0 }; /* black */
|
||||
RGBpixel pixcrit = { 255, 200, 200 }; /* burst ray hit critical component */
|
||||
RGBpixel pixghit = { 255, 0, 255 }; /* ground burst */
|
||||
RGBpixel pixmiss = { 200, 200, 200 }; /* shot missed target */
|
||||
RGBpixel pixtarg = { 255, 255, 255 }; /* shot hit target */
|
||||
Trie *cmdtrie = TRIE_NULL;
|
||||
|
||||
bool batchmode = false; /* are we processing batch input now */
|
||||
bool cantwarhead = false; /* pitch or yaw will be applied to warhead */
|
||||
bool deflectcone = DFL_DEFLECT; /* cone axis deflects towards normal */
|
||||
bool dithercells = DFL_DITHER; /* if true, randomize shot within cell */
|
||||
bool fatalerror; /* must abort ray tracing */
|
||||
bool groundburst = false; /* if true, burst on imaginary ground */
|
||||
bool reportoverlaps = DFL_OVERLAPS;
|
||||
/* if true, overlaps are reported */
|
||||
bool tty = true; /* if true, full screen display is used */
|
||||
bool userinterrupt; /* has the ray trace been interrupted */
|
||||
|
||||
char airfile[LNBUFSZ]={0}; /* input file name for burst air ids */
|
||||
char armorfile[LNBUFSZ]={0}; /* input file name for burst armor ids */
|
||||
char burstfile[LNBUFSZ]={0}; /* input file name for burst points */
|
||||
char cmdbuf[LNBUFSZ];
|
||||
char cmdname[LNBUFSZ];
|
||||
char colorfile[LNBUFSZ]={0}; /* ident range-to-color file name */
|
||||
char critfile[LNBUFSZ]={0}; /* input file for critical components */
|
||||
char errfile[LNBUFSZ]={0}; /* errors/diagnostics log file name */
|
||||
char fbfile[LNBUFSZ]={0}; /* frame buffer image file name */
|
||||
char gedfile[LNBUFSZ]={0}; /* MGED data base file name */
|
||||
char gridfile[LNBUFSZ]={0}; /* saved grid (2-d shots) file name */
|
||||
char histfile[LNBUFSZ]={0}; /* histogram file name (statistics) */
|
||||
char objects[LNBUFSZ]={0}; /* list of objects from MGED file */
|
||||
char outfile[LNBUFSZ]={0}; /* burst point library output file name */
|
||||
char plotfile[LNBUFSZ]={0}; /* 3-D UNIX plot file name (debugging) */
|
||||
char scrbuf[LNBUFSZ]; /* scratch buffer for temporary use */
|
||||
char scriptfile[LNBUFSZ]={0}; /* shell script file name */
|
||||
char shotfile[LNBUFSZ]; /* input file of firing coordinates */
|
||||
char shotlnfile[LNBUFSZ]={0}; /* shotline output file name */
|
||||
char title[TITLE_LEN]; /* title of MGED target description */
|
||||
char timer[TIMER_LEN]; /* CPU usage statistics */
|
||||
char tmpfname[TIMER_LEN]; /* temporary file for logging input */
|
||||
|
||||
char *cmdptr;
|
||||
|
||||
fastf_t bdist = DFL_BDIST;
|
||||
/* fusing distance for warhead */
|
||||
fastf_t burstpoint[3]; /* explicit burst point coordinates */
|
||||
fastf_t cellsz = DFL_CELLSIZE;
|
||||
/* shotline separation */
|
||||
fastf_t conehfangle = DFL_CONEANGLE;
|
||||
/* spall cone half angle */
|
||||
fastf_t fire[3]; /* explicit firing coordinates (2-D or 3-D) */
|
||||
fastf_t griddn; /* distance in model coordinates from origin to
|
||||
bottom border of grid */
|
||||
fastf_t gridlf; /* distance to left border */
|
||||
fastf_t gridrt; /* distance to right border */
|
||||
fastf_t gridup; /* distance to top border */
|
||||
fastf_t gridhor[3]; /* horizontal grid direction cosines */
|
||||
fastf_t gridsoff[3]; /* origin of grid translated by stand-off */
|
||||
fastf_t gridver[3]; /* vertical grid direction cosines */
|
||||
fastf_t grndbk = 0.0; /* distance to back border of ground plane (-X) */
|
||||
fastf_t grndht = 0.0; /* distance of ground plane below target origin (-Z) */
|
||||
fastf_t grndfr = 0.0; /* distance to front border of ground plane (+X) */
|
||||
fastf_t grndlf = 0.0; /* distance to left border of ground plane (+Y) */
|
||||
fastf_t grndrt = 0.0; /* distance to right border of ground plane (-Y) */
|
||||
fastf_t modlcntr[3]; /* centroid of target's bounding RPP */
|
||||
fastf_t modldn = 0.0; /* distance in model coordinates from origin to bottom
|
||||
extent of projection of model in grid plane */
|
||||
fastf_t modllf = 0.0; /* distance to left extent */
|
||||
fastf_t modlrt = 0.0; /* distance to right extent */
|
||||
fastf_t modlup = 0.0; /* distance to top extent */
|
||||
fastf_t raysolidangle; /* solid angle per spall sampling ray */
|
||||
fastf_t standoff; /* distance from model origin to grid */
|
||||
fastf_t unitconv = 1.0; /* units conversion factor (mm to "units") */
|
||||
fastf_t viewazim = DFL_AZIMUTH;
|
||||
/* degrees from X-axis to firing position */
|
||||
fastf_t viewelev = DFL_ELEVATION;
|
||||
/* degrees from XY-plane to firing position */
|
||||
|
||||
/* These are the angles and fusing distance used to specify the path of
|
||||
the canted warhead in Bob Wilson's simulation.
|
||||
*/
|
||||
fastf_t pitch = 0.0; /* elevation above path of main penetrator */
|
||||
fastf_t yaw = 0.0; /* deviation right of path of main penetrator */
|
||||
|
||||
/* useful vectors */
|
||||
fastf_t xaxis[3] = { 1.0, 0.0, 0.0 };
|
||||
fastf_t zaxis[3] = { 0.0, 0.0, 1.0 };
|
||||
fastf_t negzaxis[3] = { 0.0, 0.0, -1.0 };
|
||||
|
||||
int co; /* columns of text displayable on video screen */
|
||||
int devwid; /* width in pixels of frame buffer window */
|
||||
int devhgt; /* height in pixels of frame buffer window */
|
||||
int firemode = FM_DFLT; /* mode of specifying shots */
|
||||
int gridsz = 512;
|
||||
int gridxfin;
|
||||
int gridyfin;
|
||||
int gridxorg;
|
||||
int gridyorg;
|
||||
int gridwidth; /* Grid width in cells. */
|
||||
int gridheight; /* Grid height in cells. */
|
||||
int li; /* lines of text displayable on video screen */
|
||||
int nbarriers = DFL_BARRIERS;
|
||||
/* no. of barriers allowed to critical comp */
|
||||
int noverlaps = 0; /* no. of overlaps encountered in this view */
|
||||
int nprocessors; /* no. of processors running concurrently */
|
||||
int nriplevels = DFL_RIPLEVELS;
|
||||
/* no. of levels of ripping (0 = no ripping) */
|
||||
int nspallrays = DFL_NRAYS;
|
||||
/* no. of spall rays at each burst point */
|
||||
int units = DFL_UNITS; /* target units (default is millimeters) */
|
||||
int zoom = 1; /* magnification factor on frame buffer */
|
||||
|
||||
struct rt_i *rtip = RTI_NULL; /* model specific access from librt */
|
||||
|
||||
/* signal handlers */
|
||||
#if STD_SIGNAL_DECLS
|
||||
void (*norml_sig)(); /* active during interactive operation */
|
||||
void (*abort_sig)(); /* active during ray tracing only */
|
||||
#else
|
||||
int (*norml_sig)();
|
||||
int (*abort_sig)();
|
||||
#endif
|
||||
-1597
File diff suppressed because it is too large
Load Diff
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
Author: Jeff Hanes
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
|
||||
Modified: Gary S. Moss (Added roll rotation.)
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "$Header$ (BRL)";
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include "machine.h"
|
||||
#include "./vecmath.h"
|
||||
|
||||
void gridRotate();
|
||||
|
||||
/*
|
||||
void gridRotate( fastf_t azim, fastf_t elev, fastf_t roll,
|
||||
register fastf_t *des_H, register fastf_t *des_V )
|
||||
|
||||
Creates the unit vectors H and V which are the horizontal
|
||||
and vertical components of the grid in target coordinates.
|
||||
The vectors are found from the azimuth and elivation of the
|
||||
viewing angle according to a simplification of the rotation
|
||||
matrix from grid coordinates to target coordinates.
|
||||
To see that the vectors are, indeed, unit vectors, recall
|
||||
the trigonometric relation:
|
||||
|
||||
sin( A )^2 + cos( A )^2 = 1 .
|
||||
|
||||
*/
|
||||
void
|
||||
gridRotate( azim, elev, roll, des_H, des_V )
|
||||
fastf_t azim, elev, roll;
|
||||
register fastf_t *des_H, *des_V;
|
||||
{ fastf_t sn_azm = sin( azim );
|
||||
fastf_t cs_azm = cos( azim );
|
||||
fastf_t sn_elv = sin( elev );
|
||||
des_H[0] = -sn_azm;
|
||||
des_H[1] = cs_azm;
|
||||
des_H[2] = 0.0;
|
||||
des_V[0] = -sn_elv*cs_azm;
|
||||
des_V[1] = -sn_elv*sn_azm;
|
||||
des_V[2] = cos( elev );
|
||||
|
||||
if( roll != 0.0 )
|
||||
{ fastf_t tmp_V[3], tmp_H[3], prime_V[3];
|
||||
fastf_t sn_roll = sin( roll );
|
||||
fastf_t cs_roll = cos( roll );
|
||||
Scale2Vec( des_V, cs_roll, tmp_V );
|
||||
Scale2Vec( des_H, sn_roll, tmp_H );
|
||||
Add2Vec( tmp_V, tmp_H, prime_V );
|
||||
Scale2Vec( des_V, -sn_roll, tmp_V );
|
||||
Scale2Vec( des_H, cs_roll, tmp_H );
|
||||
Add2Vec( tmp_V, tmp_H, des_H );
|
||||
CopyVec( des_V, prime_V );
|
||||
}
|
||||
return;
|
||||
}
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6647 or AV-298-6647
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "./burst.h"
|
||||
#include "./vecmath.h"
|
||||
#define DEBUG_IDENTS false
|
||||
|
||||
bool
|
||||
findIdents( ident, idp )
|
||||
int ident;
|
||||
register Ids *idp;
|
||||
{
|
||||
#if DEBUG_IDENTS
|
||||
rt_log( "findIdents(%d)\n", ident );
|
||||
#endif
|
||||
for( idp = idp->i_next ; idp != IDS_NULL; idp = idp->i_next )
|
||||
{
|
||||
#if DEBUG_IDENTS
|
||||
rt_log( "lower=%d, upper=%d\n", (int) idp->i_lower,
|
||||
(int) idp->i_upper );
|
||||
#endif
|
||||
if( ident >= (int) idp->i_lower
|
||||
&& ident <= (int) idp->i_upper
|
||||
)
|
||||
return true;
|
||||
}
|
||||
#if DEBUG_IDENTS
|
||||
rt_log( "returned false\n" );
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
Colors *
|
||||
findColors( ident, colp )
|
||||
int ident;
|
||||
register Colors *colp;
|
||||
{
|
||||
for( colp = colp->c_next; colp != COLORS_NULL; colp = colp->c_next )
|
||||
{
|
||||
if( ident >= (int) colp->c_lower
|
||||
&& ident <= (int) colp->c_upper
|
||||
)
|
||||
return colp;
|
||||
}
|
||||
return COLORS_NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
readIdents( idlist, fp )
|
||||
Ids *idlist;
|
||||
FILE *fp;
|
||||
{ char input_buf[BUFSIZ];
|
||||
int lower, upper;
|
||||
register Ids *idp;
|
||||
for( idp = idlist;
|
||||
fgets( input_buf, BUFSIZ, fp ) != NULL;
|
||||
)
|
||||
{ char *token;
|
||||
token = strtok( input_buf, ",-:; \t" );
|
||||
if( token == NULL || sscanf( token, "%d", &lower ) < 1 )
|
||||
continue;
|
||||
token = strtok( NULL, " \t" );
|
||||
if( token == NULL || sscanf( token, "%d", &upper ) < 1 )
|
||||
upper = lower;
|
||||
if( (idp->i_next = (Ids *) malloc( sizeof(Ids) )) == IDS_NULL )
|
||||
{
|
||||
Malloc_Bomb( sizeof(Ids) );
|
||||
return false;
|
||||
}
|
||||
idp = idp->i_next;
|
||||
idp->i_lower = lower;
|
||||
idp->i_upper = upper;
|
||||
}
|
||||
idp->i_next = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
readColors( colorlist, fp )
|
||||
Colors *colorlist;
|
||||
FILE *fp;
|
||||
{ char input_buf[BUFSIZ];
|
||||
int lower, upper;
|
||||
int rgb[3];
|
||||
register Colors *colp;
|
||||
for( colp = colorlist;
|
||||
fgets( input_buf, BUFSIZ, fp ) != NULL;
|
||||
)
|
||||
{ int items;
|
||||
if( (items =
|
||||
sscanf( input_buf,
|
||||
"%d %d %d %d %d\n",
|
||||
&lower, &upper, &rgb[0], &rgb[1], &rgb[2]
|
||||
)) < 5
|
||||
)
|
||||
{
|
||||
if( items == EOF )
|
||||
break;
|
||||
else
|
||||
{
|
||||
rt_log( "readColors(): only %d items read\n",
|
||||
items );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if( (colp->c_next = (Colors *) malloc( sizeof(Colors) ))
|
||||
== COLORS_NULL
|
||||
)
|
||||
{
|
||||
Malloc_Bomb( sizeof(Colors) );
|
||||
return false;
|
||||
}
|
||||
colp = colp->c_next;
|
||||
colp->c_lower = lower;
|
||||
colp->c_upper = upper;
|
||||
CopyVec( colp->c_rgb, rgb );
|
||||
}
|
||||
colp->c_next = NULL;
|
||||
return true;
|
||||
}
|
||||
-215
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
#define NDEBUG
|
||||
#define STATIC static
|
||||
#else
|
||||
#define STATIC
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
#include "fb.h"
|
||||
|
||||
#include "./vecmath.h"
|
||||
#include "./extern.h"
|
||||
|
||||
#define DEBUG_CELLFB 0
|
||||
#define DEBUG_SPALLFB 0
|
||||
|
||||
/* Offset frame buffer coordinates to center of cell from grid lines. */
|
||||
#define CenterCell(b) (b += round( (fastf_t) zoom / 2.0 ))
|
||||
|
||||
/* Compare one RGB pixel to another. */
|
||||
#define SAMERGB(a,b) ((a)[RED] == (b)[RED] &&\
|
||||
(a)[GRN] == (b)[GRN] &&\
|
||||
(a)[BLU] == (b)[BLU])
|
||||
|
||||
static RGBpixel pixbuf[MAXDEVWID];
|
||||
static int gridxmargin;
|
||||
static int gridymargin;
|
||||
|
||||
/*
|
||||
fastf_t abs( fastf_t a )
|
||||
|
||||
Returns the absolute value of 'a'. Useful when a macro would
|
||||
cause side-effects or redundant computation.
|
||||
*/
|
||||
STATIC fastf_t
|
||||
abs( a )
|
||||
fastf_t a;
|
||||
{
|
||||
return Abs( a );
|
||||
}
|
||||
|
||||
void
|
||||
gridToFb( gx, gy, fxp, fyp )
|
||||
int gx, gy;
|
||||
int *fxp, *fyp;
|
||||
{
|
||||
/* map grid offsets to frame buffer coordinates */
|
||||
*fxp = (gx - gridxorg)*zoom + gridxmargin;
|
||||
*fyp = (gy - gridyorg)*zoom + gridymargin;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
paintGridFb()
|
||||
{ register int gx, gy;
|
||||
register int fx, fy;
|
||||
int fxbeg, fybeg;
|
||||
int fxfin, fyfin;
|
||||
int fxorg, fyorg;
|
||||
int fgridwid;
|
||||
if( fb_clear( fbiop, pixbkgr ) == -1 )
|
||||
return;
|
||||
gridxmargin = (devwid - (gridwidth*zoom)) / 2.0;
|
||||
gridymargin = (devhgt - (gridheight*zoom)) / 2.0;
|
||||
gridToFb( gridxorg, gridyorg, &fxbeg, &fybeg );
|
||||
gridToFb( gridxfin+1, gridyfin+1, &fxfin, &fyfin );
|
||||
gridToFb( 0, 0, &fxorg, &fyorg );
|
||||
CenterCell( fxorg ); /* center of cell */
|
||||
CenterCell( fyorg );
|
||||
if( zoom == 1 )
|
||||
{
|
||||
fgridwid = gridwidth + 2;
|
||||
fxfin++;
|
||||
}
|
||||
else
|
||||
fgridwid = gridwidth * zoom + 1;
|
||||
|
||||
/* draw vertical lines */
|
||||
for( fx = 1; fx < fgridwid; fx++ )
|
||||
COPYRGB( pixbuf[fx], pixbkgr );
|
||||
for( fx = fxbeg; fx <= fxfin; fx += zoom )
|
||||
COPYRGB( pixbuf[fx-fxbeg], pixgrid[0] );
|
||||
for( fy = fybeg; fy <= fyfin; fy++ )
|
||||
(void) fb_write( fbiop, fxbeg, fy, pixbuf, fgridwid );
|
||||
for( fy = 0; fy < devwid; fy++ )
|
||||
(void) fb_write( fbiop, fxorg, fy, pixaxis, 1 );
|
||||
|
||||
/* draw horizontal lines */
|
||||
if( zoom > 1 )
|
||||
for( fy = fybeg; fy <= fyfin; fy += zoom )
|
||||
(void) fb_write( fbiop,
|
||||
fxbeg, fy, pixgrid, fgridwid ); for( fx = 0; fx < devwid; fx++ )
|
||||
COPYRGB( pixbuf[fx], pixaxis );
|
||||
(void) fb_write( fbiop, 0, fyorg, pixbuf, devwid );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
paintCellFb( ap, pixpaint, pixexpendable )
|
||||
register struct application *ap;
|
||||
RGBpixel *pixpaint;
|
||||
RGBpixel *pixexpendable;
|
||||
{ int gx, gy;
|
||||
register int gyfin, gxfin;
|
||||
register int gxorg, gyorg;
|
||||
register int x, y;
|
||||
int cnt;
|
||||
#if DEBUG_CELLFB
|
||||
rt_log( "paintCellFb: expendable {%d,%d,%d}\n",
|
||||
(*pixexpendable)[RED],
|
||||
(*pixexpendable)[GRN],
|
||||
(*pixexpendable)[BLU] );
|
||||
#endif
|
||||
gridToFb( ap->a_x, ap->a_y, &gx, &gy );
|
||||
gxorg = gx+1;
|
||||
gyorg = gy+1;
|
||||
gxfin = zoom == 1 ? gx+zoom+1 : gx+zoom;
|
||||
gyfin = zoom == 1 ? gy+zoom+1 : gy+zoom;
|
||||
cnt = gxfin - gxorg;
|
||||
for( y = gyorg; y < gyfin; y++ )
|
||||
{
|
||||
if( zoom != 1 && (y - gy) % zoom == 0 )
|
||||
continue;
|
||||
RES_ACQUIRE( &rt_g.res_stats );
|
||||
(void) fb_read( fbiop, gxorg, y, pixbuf, cnt );
|
||||
RES_RELEASE( &rt_g.res_stats );
|
||||
for( x = gxorg; x < gxfin; x++ )
|
||||
{
|
||||
if( SAMERGB( pixbuf[x-gxorg], *pixexpendable )
|
||||
)
|
||||
{
|
||||
#if DEBUG_CELLFB
|
||||
rt_log( "Clobbering:<%d,%d>{%d,%d,%d}\n",
|
||||
x, y,
|
||||
(pixbuf[x-gxorg])[RED],
|
||||
(pixbuf[x-gxorg])[GRN],
|
||||
(pixbuf[x-gxorg])[BLU] );
|
||||
#endif
|
||||
COPYRGB( pixbuf[x-gxorg], *pixpaint );
|
||||
}
|
||||
#if DEBUG_CELLFB
|
||||
else
|
||||
rt_log( "Preserving:<%d,%d>{%d,%d,%d}\n",
|
||||
x, y,
|
||||
(pixbuf[x-gxorg])[RED],
|
||||
(pixbuf[x-gxorg])[GRN],
|
||||
(pixbuf[x-gxorg])[BLU] );
|
||||
#endif
|
||||
}
|
||||
RES_ACQUIRE( &rt_g.res_stats );
|
||||
(void) fb_write( fbiop, gxorg, y, pixbuf, cnt );
|
||||
RES_RELEASE( &rt_g.res_stats );
|
||||
#if DEBUG_CELLFB
|
||||
rt_log( "paintCellFb: fb_write(%d,%d)\n", x, y );
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
paintSpallFb( ap )
|
||||
register struct application *ap;
|
||||
{ RGBpixel pixel;
|
||||
int x, y;
|
||||
int err;
|
||||
fastf_t celldist;
|
||||
#if DEBUG_SPALLFB
|
||||
rt_log( "paintSpallFb: a_x=%d a_y=%d a_cumlen=%g cellsz=%g zoom=%d\n",
|
||||
ap->a_x, ap->a_y, ap->a_cumlen, cellsz, zoom );
|
||||
#endif
|
||||
pixel[RED] = ap->a_color[RED] * 255;
|
||||
pixel[GRN] = ap->a_color[GRN] * 255;
|
||||
pixel[BLU] = ap->a_color[BLU] * 255;
|
||||
gridToFb( ap->a_x, ap->a_y, &x, &y );
|
||||
CenterCell( x ); /* center of cell */
|
||||
CenterCell( y );
|
||||
celldist = ap->a_cumlen/cellsz * zoom;
|
||||
x = round( x + Dot( ap->a_ray.r_dir, gridhor ) * celldist );
|
||||
y = round( y + Dot( ap->a_ray.r_dir, gridver ) * celldist );
|
||||
RES_ACQUIRE( &rt_g.res_stats );
|
||||
err = fb_write( fbiop, x, y, pixel, 1 );
|
||||
RES_RELEASE( &rt_g.res_stats );
|
||||
#if DEBUG_SPALLFB
|
||||
rt_log( "paintSpallFb:gridhor=<%g,%g,%g> gridver=<%g,%g,%g>\n",
|
||||
gridhor[X], gridhor[Y], gridhor[Z],
|
||||
gridver[X], gridver[Y], gridver[Z] );
|
||||
rt_log( "paintSpallFb:fb_write(x=%d,y=%d,pixel={%d,%d,%d})\n",
|
||||
x, y,
|
||||
(int) pixel[RED],
|
||||
(int) pixel[GRN],
|
||||
(int) pixel[BLU]
|
||||
);
|
||||
#endif
|
||||
if( err == -1 )
|
||||
rt_log( "Write failed to pixel <%d,%d> from cell <%d,%d>.\n",
|
||||
x, y, ap->a_x, ap->a_y );
|
||||
return;
|
||||
}
|
||||
-128
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6647 or AV-298-6647
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
#include "./vecmath.h"
|
||||
#include "./burst.h"
|
||||
#include "./extern.h"
|
||||
#define R_GRID 255
|
||||
#define G_GRID 255
|
||||
#define B_GRID 0
|
||||
#define R_BURST 255
|
||||
#define G_BURST 0
|
||||
#define B_BURST 0
|
||||
|
||||
void
|
||||
plotInit()
|
||||
{ int x1, y1, z1, x2, y2, z2;
|
||||
if( plotfp == NULL )
|
||||
return;
|
||||
x1 = (int) rtip->mdl_min[X] - 1;
|
||||
y1 = (int) rtip->mdl_min[Y] - 1;
|
||||
z1 = (int) rtip->mdl_min[Z] - 1;
|
||||
x2 = (int) rtip->mdl_max[X] + 1;
|
||||
y2 = (int) rtip->mdl_max[Y] + 1;
|
||||
z2 = (int) rtip->mdl_max[Z] + 1;
|
||||
pl_3space( plotfp, x1, y1, z1, x2, y2, z2 );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
plotGrid( r_pt )
|
||||
register fastf_t *r_pt;
|
||||
{
|
||||
if( plotfp == NULL )
|
||||
return;
|
||||
pl_color( plotfp, R_GRID, G_GRID, B_GRID );
|
||||
pl_3point( plotfp, (int) r_pt[X], (int) r_pt[Y], (int) r_pt[Z] );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
plotRay( rayp )
|
||||
register struct xray *rayp;
|
||||
{ int endpoint[3];
|
||||
if( plotfp == NULL )
|
||||
return;
|
||||
VJOIN1( endpoint, rayp->r_pt, cellsz, rayp->r_dir );
|
||||
RES_ACQUIRE( &rt_g.res_syscall );
|
||||
pl_color( plotfp, R_BURST, G_BURST, B_BURST );
|
||||
#if 0
|
||||
pl_3line( plotfp,
|
||||
(int) rayp->r_pt[X],
|
||||
(int) rayp->r_pt[Y],
|
||||
(int) rayp->r_pt[Z],
|
||||
endpoint[X],
|
||||
endpoint[Y],
|
||||
endpoint[Z]
|
||||
);
|
||||
#else
|
||||
pl_3point( plotfp, (int) endpoint[X], (int) endpoint[Y], (int) endpoint[Z] );
|
||||
#endif
|
||||
RES_RELEASE( &rt_g.res_syscall );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
plotPartition( ihitp, ohitp, rayp, regp )
|
||||
struct hit *ihitp;
|
||||
register struct hit *ohitp ;
|
||||
register struct xray *rayp;
|
||||
struct region *regp;
|
||||
{
|
||||
if( plotfp == NULL )
|
||||
return;
|
||||
#if 0
|
||||
if( regp->reg_mater.ma_rgb[0] == 0
|
||||
&& regp->reg_mater.ma_rgb[1] == 0
|
||||
&& regp->reg_mater.ma_rgb[2] == 0
|
||||
)
|
||||
pl_color( plotfp, 255, 255, 255 );
|
||||
else
|
||||
pl_color( plotfp,
|
||||
(int) regp->reg_mater.ma_rgb[0],
|
||||
(int) regp->reg_mater.ma_rgb[1],
|
||||
(int) regp->reg_mater.ma_rgb[2]
|
||||
);
|
||||
#endif
|
||||
RES_ACQUIRE( &rt_g.res_syscall );
|
||||
pl_3line( plotfp,
|
||||
(int) ihitp->hit_point[X],
|
||||
(int) ihitp->hit_point[Y],
|
||||
(int) ihitp->hit_point[Z],
|
||||
(int) ohitp->hit_point[X],
|
||||
(int) ohitp->hit_point[Y],
|
||||
(int) ohitp->hit_point[Z]
|
||||
);
|
||||
RES_RELEASE( &rt_g.res_syscall );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
plotShieldComp( rayp, qp )
|
||||
register struct xray *rayp;
|
||||
register Pt_Queue *qp;
|
||||
{ register struct hit *ohitp;
|
||||
if( qp == PT_Q_NULL )
|
||||
return;
|
||||
plotShieldComp( rayp, qp->q_next );
|
||||
|
||||
/* Fill in hit point and normal. */
|
||||
ohitp = qp->q_part->pt_outhit;
|
||||
VJOIN1( ohitp->hit_point, rayp->r_pt, ohitp->hit_dist, rayp->r_dir );
|
||||
colorPartition( qp->q_part->pt_regionp, C_SHIELD );
|
||||
plotPartition( qp->q_part->pt_inhit, ohitp, rayp, qp->q_part->pt_regionp );
|
||||
return;
|
||||
}
|
||||
-942
@@ -1,942 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
#define NDEBUG
|
||||
#define STATIC static
|
||||
#else
|
||||
#define STATIC
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Sc/Sc.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
|
||||
#include "./vecmath.h"
|
||||
#include "./ascii.h"
|
||||
#include "./extern.h"
|
||||
|
||||
|
||||
#define MAX_COLS 128
|
||||
|
||||
#define PHANTOM_ARMOR 111
|
||||
|
||||
STATIC fastf_t getNormThickness();
|
||||
|
||||
int
|
||||
doMore( linesp )
|
||||
int *linesp;
|
||||
{ register int ret = true;
|
||||
if( ! tty )
|
||||
return true;
|
||||
TcSaveTty( HmTtyFd );
|
||||
TcSetRaw( HmTtyFd );
|
||||
TcClrEcho( HmTtyFd );
|
||||
ScSetStandout();
|
||||
prompt( "-- More -- " );
|
||||
ScClrStandout();
|
||||
(void) fflush( stdout );
|
||||
switch( HmGetchar() )
|
||||
{
|
||||
case 'q' :
|
||||
case 'n' :
|
||||
ret = false;
|
||||
break;
|
||||
case LF :
|
||||
case CR :
|
||||
*linesp = 1;
|
||||
break;
|
||||
default :
|
||||
*linesp = (PROMPT_Y-SCROLL_TOP);
|
||||
break;
|
||||
}
|
||||
TcResetTty( HmTtyFd );
|
||||
return ret;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
f_Nerror( ap )
|
||||
struct application *ap;
|
||||
{
|
||||
rt_log( "Couldn't compute thickness or exit point%s.\n",
|
||||
"along normal direction" );
|
||||
V_Print( "\tpnt", ap->a_ray.r_pt, rt_log );
|
||||
V_Print( "\tdir", ap->a_ray.r_dir, rt_log );
|
||||
ap->a_rbeam = 0.0;
|
||||
VSET( ap->a_vvec, 0.0, 0.0, 0.0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* f_Normal()
|
||||
|
||||
Shooting from surface of object along reversed entry normal to
|
||||
compute exit point along normal direction and normal thickness.
|
||||
Exit point returned in "a_vvec", thickness returned in "a_rbeam".
|
||||
*/
|
||||
STATIC int
|
||||
f_Normal( ap, pt_headp )
|
||||
struct application *ap;
|
||||
struct partition *pt_headp;
|
||||
{ register struct partition *pp = pt_headp->pt_forw;
|
||||
register struct partition *cp;
|
||||
register struct xray *rp = &ap->a_ray;
|
||||
register struct hit *ohitp;
|
||||
for( cp = pp->pt_forw;
|
||||
cp != pt_headp && SameCmp( pp->pt_regionp, cp->pt_regionp );
|
||||
cp = cp->pt_forw
|
||||
)
|
||||
;
|
||||
ohitp = cp->pt_back->pt_outhit;
|
||||
ap->a_rbeam = ohitp->hit_dist - pp->pt_inhit->hit_dist;
|
||||
VJOIN1( ap->a_vvec, rp->r_pt, ohitp->hit_dist, rp->r_dir );
|
||||
#ifdef DEBUG
|
||||
rt_log( "f_Normal: thickness=%g dout=%g din=%g\n",
|
||||
ap->a_rbeam*unitconv, ohitp->hit_dist, pp->pt_inhit->hit_dist );
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include <errno.h>
|
||||
/* These aren't defined in BSD errno.h. */
|
||||
extern int errno;
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
void
|
||||
locPerror( msg )
|
||||
char *msg;
|
||||
{
|
||||
if( errno > 0 && errno < sys_nerr )
|
||||
rt_log( "%s: %s\n", msg, sys_errlist[errno] );
|
||||
else
|
||||
rt_log( "BUG: errno not set, shouldn't call perror.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
notify( str, mode )
|
||||
char *str;
|
||||
int mode;
|
||||
{ register int i;
|
||||
static int lastlen = -1;
|
||||
register int len;
|
||||
static char buf[LNBUFSZ] = { 0 };
|
||||
register char *p;
|
||||
if( ! tty )
|
||||
return false;
|
||||
switch( mode )
|
||||
{
|
||||
case NOTIFY_APPEND :
|
||||
p = buf + lastlen;
|
||||
break;
|
||||
case NOTIFY_DELETE :
|
||||
for( p = buf+lastlen; p > buf && *p != NOTIFY_DELIM; p-- )
|
||||
;
|
||||
break;
|
||||
case NOTIFY_ERASE :
|
||||
p = buf;
|
||||
break;
|
||||
}
|
||||
if( str != NULL )
|
||||
{
|
||||
if( p > buf )
|
||||
*p++ = NOTIFY_DELIM;
|
||||
(void) strcpy( p, str );
|
||||
}
|
||||
else
|
||||
*p = NUL;
|
||||
(void) ScMvCursor( PROMPT_X, PROMPT_Y );
|
||||
len = strlen( buf );
|
||||
if( len > 0 )
|
||||
{
|
||||
(void) ScSetStandout();
|
||||
(void) fputs( buf, stdout );
|
||||
(void) ScClrStandout();
|
||||
}
|
||||
|
||||
/* Blank out remainder of previous command. */
|
||||
for( i = len; i < lastlen; i++ )
|
||||
(void) putchar( ' ' );
|
||||
(void) ScMvCursor( PROMPT_X, PROMPT_Y );
|
||||
(void) fflush( stdout );
|
||||
lastlen = len;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntAspectInit( void )
|
||||
|
||||
Burst Point Library and Shotline file: header record for each view.
|
||||
Ref. Figure 20., Line Number 1 and Figure 19., Line Number 1 of ICD.
|
||||
*/
|
||||
void
|
||||
prntAspectInit()
|
||||
{ fastf_t projarea; /* projected area */
|
||||
/* Convert to user units before squaring cell size. */
|
||||
projarea = cellsz*unitconv;
|
||||
projarea *= projarea;
|
||||
if( outfile[0] != NUL
|
||||
&& fprintf(outfp,
|
||||
"%c % 8.4f % 8.4f % 4.1f % 10.2f %-6s\n",
|
||||
PB_ASPECT_INIT,
|
||||
viewazim*DEGRAD, /* attack azimuth in degrees */
|
||||
viewelev*DEGRAD, /* attack elevation in degrees */
|
||||
bdist*unitconv, /* BDIST */
|
||||
projarea, /* projected area associated with burst pt. */
|
||||
units == U_INCHES ? "inches" :
|
||||
units == U_FEET ? "feet" :
|
||||
units == U_MILLIMETERS ? "mm" :
|
||||
units == U_CENTIMETERS ? "cm" :
|
||||
units == U_METERS ? "meters" : "units?"
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", outfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
if( shotlnfile[0] != NUL
|
||||
&& fprintf(shotlnfp,
|
||||
"%c % 8.4f % 8.4f % 7.2f % 7.2f %7.2f %7.2f %7.2f %-6s\n",
|
||||
PS_ASPECT_INIT,
|
||||
viewazim*DEGRAD, /* attack azimuth in degrees */
|
||||
viewelev*DEGRAD, /* attack elevation in degrees */
|
||||
cellsz*unitconv, /* shotline separation */
|
||||
modlrt*unitconv, /* maximum Y'-coordinate of target */
|
||||
modllf*unitconv, /* minimum Y'-coordinate of target */
|
||||
modlup*unitconv, /* maximum Z'-coordinate of target */
|
||||
modldn*unitconv, /* minimum Z'-coordinate of target */
|
||||
units == U_INCHES ? "inches" :
|
||||
units == U_FEET ? "feet" :
|
||||
units == U_MILLIMETERS ? "mm" :
|
||||
units == U_CENTIMETERS ? "cm" :
|
||||
units == U_METERS ? "meters" : "units?"
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", shotlnfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntCellIdent( struct application *ap )
|
||||
|
||||
Burst Point Library and Shotline file: information about shotline.
|
||||
Ref. Figure 20., Line Number 2 and Figure 19., Line Number 2 of ICD.
|
||||
*/
|
||||
void
|
||||
prntCellIdent( ap )
|
||||
register struct application *ap;
|
||||
{
|
||||
if( outfile[0] != NUL
|
||||
&& fprintf(outfp,
|
||||
"%c % 8.2f % 8.2f\n",
|
||||
PB_CELL_IDENT,
|
||||
ap->a_uvec[X]*unitconv,
|
||||
/* horizontal coordinate of shotline (Y') */
|
||||
ap->a_uvec[Y]*unitconv
|
||||
/* vertical coordinate of shotline (Z') */
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", outfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
if( shotlnfile[0] != NUL
|
||||
&& fprintf(shotlnfp,
|
||||
"%c % 8.2f % 8.2f\n",
|
||||
PS_CELL_IDENT,
|
||||
ap->a_uvec[X]*unitconv,
|
||||
/* horizontal coordinate of shotline (Y') */
|
||||
ap->a_uvec[Y]*unitconv
|
||||
/* vertical coordinate of shotline (Z') */
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", shotlnfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntSeg( struct application *ap, struct partition *cpp, int space )
|
||||
|
||||
Burst Point Library and Shotline file: information about each component
|
||||
hit along path of main penetrator (shotline).
|
||||
Ref. Figure 20., Line Number 3 and Figure 19., Line Number 2 of ICD.
|
||||
*/
|
||||
void
|
||||
prntSeg( ap, cpp, space )
|
||||
register struct application *ap;
|
||||
register struct partition *cpp; /* component partition */
|
||||
int space;
|
||||
{ fastf_t cosobliquity; /* cosine of obliquity at entry */
|
||||
fastf_t cosrotation; /* cosine of rotation angle */
|
||||
fastf_t entryangle; /* obliquity angle at entry */
|
||||
fastf_t exitangle; /* obliquity angle at exit */
|
||||
fastf_t los; /* line-of-sight thickness */
|
||||
fastf_t normthickness; /* normal thickness */
|
||||
fastf_t rotangle; /* rotation angle */
|
||||
fastf_t sinfbangle; /* sine of fall back angle */
|
||||
register struct hit *ihitp;
|
||||
register struct hit *ohitp;
|
||||
register struct soltab *stp;
|
||||
|
||||
/* fill in entry hit point and normal */
|
||||
stp = cpp->pt_inseg->seg_stp;
|
||||
ihitp = cpp->pt_inhit;
|
||||
RT_HIT_NORM( ihitp, stp, &(ap->a_ray) );
|
||||
|
||||
/* check for flipped normal and fix */
|
||||
if( cpp->pt_inflip )
|
||||
{
|
||||
ScaleVec( ihitp->hit_normal, -1.0 );
|
||||
cpp->pt_inflip = 0;
|
||||
}
|
||||
fixed_entry_normal:
|
||||
/* This *should* give negative of desired result, but make sure. */
|
||||
cosobliquity = Dot( ap->a_ray.r_dir, ihitp->hit_normal );
|
||||
if( cosobliquity < 0.0 )
|
||||
cosobliquity = -cosobliquity;
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
rt_log( "prntSeg: fixed flipped entry normal.\n" );
|
||||
rt_log( "cosine of angle of obliquity is %12.9f\n",
|
||||
cosobliquity );
|
||||
rt_log( "\tregion name '%s' solid name '%s'\n",
|
||||
cpp->pt_regionp->reg_name,
|
||||
stp->st_name );
|
||||
#endif
|
||||
ScaleVec( ihitp->hit_normal, -1.0 );
|
||||
goto fixed_entry_normal;
|
||||
}
|
||||
cosrotation = Dot( ihitp->hit_normal, xaxis );
|
||||
sinfbangle = Dot( ihitp->hit_normal, zaxis );
|
||||
rotangle = AproxEq( cosrotation, 1.0, COS_TOL ) ?
|
||||
0.0 : acos( cosrotation ) * DEGRAD;
|
||||
los = (cpp->pt_outhit->hit_dist-ihitp->hit_dist)*unitconv;
|
||||
#ifdef DEBUG
|
||||
rt_log( "prntSeg: los=%g dout=%g din=%g\n",
|
||||
los, cpp->pt_outhit->hit_dist, ihitp->hit_dist );
|
||||
#endif
|
||||
|
||||
if( outfile[0] != NUL
|
||||
&& fprintf( outfp,
|
||||
"%c % 8.2f % 8.2f %4d %2d % 7.3f % 7.3f % 7.3f\n",
|
||||
PB_RAY_INTERSECT,
|
||||
(standoff-ihitp->hit_dist)*unitconv,
|
||||
/* X'-coordinate of intersection */
|
||||
los, /* LOS thickness of component */
|
||||
cpp->pt_regionp->reg_regionid,
|
||||
/* component code number */
|
||||
space, /* space code */
|
||||
sinfbangle, /* sine of fallback angle */
|
||||
rotangle, /* rotation angle in degrees */
|
||||
cosobliquity /* cosine of obliquity angle at entry */
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", outfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
if( shotlnfile[0] == NUL )
|
||||
return;
|
||||
entryangle = AproxEq( cosobliquity, 1.0, COS_TOL ) ?
|
||||
0.0 : acos( cosobliquity ) * DEGRAD;
|
||||
if( (normthickness =
|
||||
getNormThickness( ap, cpp, cosobliquity )) <= 0.0
|
||||
&& fatalerror )
|
||||
{
|
||||
rt_log( "Couldn't compute normal thickness.\n" );
|
||||
rt_log( "\tshotline coordinates <%g,%g>\n",
|
||||
ap->a_uvec[X]*unitconv,
|
||||
ap->a_uvec[Y]*unitconv
|
||||
);
|
||||
rt_log( "\tregion name '%s' solid name '%s'\n",
|
||||
cpp->pt_regionp->reg_name,
|
||||
stp->st_name );
|
||||
return;
|
||||
}
|
||||
/* fill in exit hit point and normal */
|
||||
stp = cpp->pt_outseg->seg_stp;
|
||||
ohitp = cpp->pt_outhit;
|
||||
RT_HIT_NORM( ohitp, stp, &(ap->a_ray) );
|
||||
|
||||
/* check for flipped normal and fix */
|
||||
if( cpp->pt_outflip )
|
||||
{
|
||||
ScaleVec( ohitp->hit_normal, -1.0 );
|
||||
cpp->pt_outflip = 0;
|
||||
}
|
||||
fixed_exit_normal:
|
||||
/* This *should* give negative of desired result, but make sure. */
|
||||
cosobliquity = Dot( ap->a_ray.r_dir, ohitp->hit_normal );
|
||||
if( cosobliquity < 0.0 )
|
||||
cosobliquity = -cosobliquity;
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
rt_log( "prntSeg: fixed flipped exit normal.\n" );
|
||||
rt_log( "cosine of angle of obliquity is %12.9f\n",
|
||||
cosobliquity );
|
||||
rt_log( "\tregion name '%s' solid name '%s'\n",
|
||||
cpp->pt_regionp->reg_name,
|
||||
stp->st_name );
|
||||
#endif
|
||||
ScaleVec( ohitp->hit_normal, -1.0 );
|
||||
goto fixed_exit_normal;
|
||||
}
|
||||
exitangle = AproxEq( cosobliquity, 1.0, COS_TOL ) ?
|
||||
0.0 : acos( cosobliquity ) * DEGRAD;
|
||||
if( fprintf( shotlnfp,
|
||||
"%c % 8.2f % 7.3f % 7.3f %4d % 8.2f % 8.2f %2d % 7.2f % 7.2f\n",
|
||||
PS_SHOT_INTERSECT,
|
||||
(standoff-ihitp->hit_dist)*unitconv,
|
||||
/* X'-coordinate of intersection */
|
||||
sinfbangle, /* sine of fallback angle */
|
||||
rotangle, /* rotation angle in degrees */
|
||||
cpp->pt_regionp->reg_regionid,
|
||||
/* component code number */
|
||||
normthickness*unitconv,
|
||||
/* normal thickness of component */
|
||||
los, /* LOS thickness of component */
|
||||
space, /* space code */
|
||||
entryangle, /* entry obliquity angle in degrees */
|
||||
exitangle /* exit obliquity angle in degrees */
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", shotlnfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntRayHeader( fastf_t *raydir, fastf_t *shotdir, unsigned rayno )
|
||||
|
||||
Burst Point Library: information about burst ray. All angles are
|
||||
WRT the shotline coordinate system, represented by X', Y' and Z'.
|
||||
Ref. Figure 20., Line Number 19 of ICD.
|
||||
*/
|
||||
void
|
||||
prntRayHeader( raydir, shotdir, rayno )
|
||||
fastf_t *raydir; /* burst ray direction vector */
|
||||
fastf_t *shotdir; /* shotline direction vector */
|
||||
unsigned rayno; /* ray number for this burst point */
|
||||
{ double cosxr; /* cosine of angle between X' and raydir */
|
||||
double cosyr; /* cosine of angle between Y' and raydir */
|
||||
fastf_t azim; /* ray azim in radians */
|
||||
fastf_t sinelev; /* sine of ray elevation */
|
||||
if( outfile[0] == NUL )
|
||||
return;
|
||||
cosxr = -Dot( shotdir, raydir ); /* shotdir is reverse of X' */
|
||||
cosyr = Dot( gridhor, raydir );
|
||||
azim = atan2( cosyr, cosxr );
|
||||
sinelev = Dot( gridver, raydir );
|
||||
if( fprintf( outfp,
|
||||
"%c % 6.3f % 6.3f % 6u\n",
|
||||
PB_RAY_HEADER,
|
||||
azim, /* ray azimuth angle WRT shotline (radians). */
|
||||
sinelev, /* sine of ray elevation angle WRT shotline. */
|
||||
rayno
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", outfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntRegionHdr( struct application *ap, struct partition *pt_headp,
|
||||
struct partition *pp )
|
||||
|
||||
Burst Point Libary: intersection along burst ray.
|
||||
Ref. Figure 20., Line Number 20 of ICD.
|
||||
*/
|
||||
void
|
||||
prntRegionHdr( ap, pt_headp, pp )
|
||||
struct application *ap;
|
||||
struct partition *pt_headp;
|
||||
struct partition *pp;
|
||||
{ fastf_t cosobliquity;
|
||||
fastf_t normthickness;
|
||||
register struct hit *ihitp = pp->pt_inhit;
|
||||
register struct hit *ohitp = pp->pt_outhit;
|
||||
register struct region *regp = pp->pt_regionp;
|
||||
register struct soltab *stp = pp->pt_inseg->seg_stp;
|
||||
register struct xray *rayp = &ap->a_ray;
|
||||
/* fill in entry/exit normals and hit points */
|
||||
RT_HIT_NORM( ihitp, stp, rayp );
|
||||
Check_Iflip( pp, ihitp->hit_normal, rayp->r_dir );
|
||||
stp = pp->pt_outseg->seg_stp;
|
||||
RT_HIT_NORM( ohitp, stp, rayp );
|
||||
Check_Oflip( pp, ohitp->hit_normal, rayp->r_dir );
|
||||
|
||||
/* calculate cosine of obliquity angle */
|
||||
fixed_normal:
|
||||
cosobliquity = Dot( ap->a_ray.r_dir, ihitp->hit_normal );
|
||||
if( cosobliquity < 0.0 )
|
||||
cosobliquity = -cosobliquity;
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
rt_log( "prntRegionHdr: fixed flipped entry normal.\n" );
|
||||
rt_log( "region name '%s'\n", regp->reg_name );
|
||||
#endif
|
||||
ScaleVec( ihitp->hit_normal, -1.0 );
|
||||
goto fixed_normal;
|
||||
}
|
||||
#if DEBUG
|
||||
if( cosobliquity - COS_TOL > 1.0 )
|
||||
{
|
||||
rt_log( "cosobliquity=%12.8f\n", cosobliquity );
|
||||
rt_log( "normal=<%g,%g,%g>\n",
|
||||
ihitp->hit_normal[X],
|
||||
ihitp->hit_normal[Y],
|
||||
ihitp->hit_normal[Z]
|
||||
);
|
||||
rt_log( "ray direction=<%g,%g,%g>\n",
|
||||
ap->a_ray.r_dir[X],
|
||||
ap->a_ray.r_dir[Y],
|
||||
ap->a_ray.r_dir[Z]
|
||||
);
|
||||
rt_log( "region name '%s'\n", regp->reg_name );
|
||||
}
|
||||
#endif
|
||||
if( outfile[0] == NUL )
|
||||
return;
|
||||
|
||||
|
||||
/* Now we must find normal thickness through component. */
|
||||
normthickness = getNormThickness( ap, pp, cosobliquity );
|
||||
RES_ACQUIRE( &rt_g.res_syscall ); /* lock */
|
||||
if( fprintf( outfp,
|
||||
"%c % 10.3f % 9.3f % 9.3f %4d %4d % 6.3f\n",
|
||||
PB_REGION_HEADER,
|
||||
ihitp->hit_dist*unitconv, /* distance from burst pt. */
|
||||
(ohitp->hit_dist - ihitp->hit_dist)*unitconv, /* LOS */
|
||||
normthickness*unitconv, /* normal thickness */
|
||||
pp->pt_forw == pt_headp ?
|
||||
EXIT_AIR : pp->pt_forw->pt_regionp->reg_aircode,
|
||||
regp->reg_regionid,
|
||||
cosobliquity
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
RES_RELEASE( &rt_g.res_syscall ); /* unlock */
|
||||
rt_log( "Write failed to file (%s)!\n", outfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
RES_RELEASE( &rt_g.res_syscall ); /* unlock */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
fastf_t getNormThickness( struct application *ap, struct partition *pp,
|
||||
fast_t cosobliquity )
|
||||
|
||||
Given a partition structure with entry hit point and normal filled in,
|
||||
the current application structure and the cosine of the obliquity at
|
||||
entry to the component, return the normal thickness through the
|
||||
component at the given hit point.
|
||||
|
||||
*/
|
||||
STATIC fastf_t
|
||||
getNormThickness( ap, pp, cosobliquity )
|
||||
register struct application *ap;
|
||||
register struct partition *pp;
|
||||
fastf_t cosobliquity;
|
||||
{ struct application a_thick;
|
||||
register struct hit *ihitp = pp->pt_inhit;
|
||||
register struct region *regp = pp->pt_regionp;
|
||||
a_thick = *ap;
|
||||
a_thick.a_hit = f_Normal;
|
||||
a_thick.a_miss = f_Nerror;
|
||||
a_thick.a_level++;
|
||||
a_thick.a_uptr = regp->reg_name;
|
||||
a_thick.a_user = regp->reg_regionid;
|
||||
CopyVec( a_thick.a_ray.r_pt, ihitp->hit_point );
|
||||
if( AproxEq( cosobliquity, 1.0, COS_TOL ) )
|
||||
{ /* Trajectory was normal to surface, so no need
|
||||
to shoot another ray. We will use the
|
||||
f_Normal routine to make sure we are
|
||||
consistant in our calculations, even
|
||||
though it requires some unnecessary vector
|
||||
math. */
|
||||
CopyVec( a_thick.a_ray.r_dir, ap->a_ray.r_dir );
|
||||
#ifdef DEBUG
|
||||
rt_log( "getNormThickness: using existing partitions.\n" );
|
||||
#endif
|
||||
(void) f_Normal( &a_thick, pp->pt_back );
|
||||
}
|
||||
else
|
||||
{ /* need to shoot ray */
|
||||
#ifdef DEBUG
|
||||
rt_log( "getNormThickness: ray tracing.\n" );
|
||||
#endif
|
||||
Scale2Vec( ihitp->hit_normal, -1.0, a_thick.a_ray.r_dir );
|
||||
if( rt_shootray( &a_thick ) == -1 && fatalerror )
|
||||
{ /* Fatal error in application routine. */
|
||||
rt_log( "Fatal error: raytracing aborted.\n" );
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
return a_thick.a_rbeam;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntShieldComp( struct application *ap, struct partition *pt_headp,
|
||||
Pt_Queue *qp )
|
||||
*/
|
||||
void
|
||||
prntShieldComp( ap, pt_headp, qp )
|
||||
struct application *ap;
|
||||
struct partition *pt_headp;
|
||||
register Pt_Queue *qp;
|
||||
{
|
||||
if( outfile[0] == NUL )
|
||||
return;
|
||||
if( qp == PT_Q_NULL )
|
||||
return;
|
||||
prntShieldComp( ap, pt_headp, qp->q_next );
|
||||
prntRegionHdr( ap, pt_headp, qp->q_part );
|
||||
return;
|
||||
}
|
||||
void
|
||||
prntColors( colorp, str )
|
||||
register Colors *colorp;
|
||||
char *str;
|
||||
{
|
||||
rt_log( "%s:\n", str );
|
||||
for( colorp = colorp->c_next;
|
||||
colorp != COLORS_NULL;
|
||||
colorp = colorp->c_next )
|
||||
{
|
||||
rt_log( "\t%d..%d\t%d,%d,%d\n",
|
||||
(int)colorp->c_lower,
|
||||
(int)colorp->c_upper,
|
||||
(int)colorp->c_rgb[0],
|
||||
(int)colorp->c_rgb[1],
|
||||
(int)colorp->c_rgb[2]
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntFiringCoords( register fastf_t *vec )
|
||||
|
||||
If the user has asked for grid coordinates to be saved, write
|
||||
them to the output stream 'gridfp'.
|
||||
*/
|
||||
void
|
||||
prntFiringCoords( vec )
|
||||
register fastf_t *vec;
|
||||
{
|
||||
if( gridfile[0] == '\0' )
|
||||
return;
|
||||
assert( gridfp != (FILE *) NULL );
|
||||
if( fprintf( gridfp, "%7.2f %7.2f\n", vec[X]*unitconv, vec[Y]*unitconv )
|
||||
< 0 )
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", gridfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
prntGridOffsets( x, y )
|
||||
int x, y;
|
||||
{
|
||||
if( ! tty )
|
||||
return;
|
||||
(void) ScMvCursor( GRID_X, GRID_Y );
|
||||
(void) printf( "[% 4d:% 4d,% 4d:% 4d]",
|
||||
x, gridxfin, y, gridyfin
|
||||
);
|
||||
(void) fflush( stdout );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
prntIdents( idp, str )
|
||||
register Ids *idp;
|
||||
char *str;
|
||||
{
|
||||
rt_log( "%s:\n", str );
|
||||
for( idp = idp->i_next ; idp != IDS_NULL; idp = idp->i_next )
|
||||
{
|
||||
if( idp->i_lower == idp->i_upper )
|
||||
rt_log( "\t%d\n", (int) idp->i_lower );
|
||||
else
|
||||
rt_log( "\t%d..%d\n",
|
||||
(int)idp->i_lower,
|
||||
(int)idp->i_upper
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**/
|
||||
void
|
||||
prntPagedMenu( menu )
|
||||
register char **menu;
|
||||
{ register int done = false;
|
||||
int lines = (PROMPT_Y-SCROLL_TOP);
|
||||
if( ! tty )
|
||||
{
|
||||
for( ; *menu != NULL; menu++ )
|
||||
rt_log( "%s\n", *menu );
|
||||
return;
|
||||
}
|
||||
for( ; *menu != NULL && ! done; )
|
||||
{
|
||||
for( ; lines > 0 && *menu != NULL; menu++, --lines )
|
||||
rt_log( "%-*s\n", co, *menu );
|
||||
if( *menu != NULL )
|
||||
done = ! doMore( &lines );
|
||||
prompt( "" );
|
||||
}
|
||||
(void) fflush( stdout );
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
void prntPhantom( struct hit *hitp, int space, fastf_t los )
|
||||
|
||||
Output "phantom armor" pseudo component. This component has no
|
||||
surface normal or thickness, so many zero fields are used for
|
||||
conformity with the normal component output formats.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
prntPhantom( hitp, space, los )
|
||||
struct hit *hitp; /* ptr. to phantom's intersection information */
|
||||
int space; /* space code behind phantom */
|
||||
fastf_t los; /* LOS of space */
|
||||
{
|
||||
if( outfile[0] != NUL
|
||||
&& fprintf( outfp,
|
||||
"%c % 8.2f % 8.2f %4d %2d % 7.3f % 7.3f % 7.3f\n",
|
||||
PB_RAY_INTERSECT,
|
||||
(standoff-hitp->hit_dist)*unitconv,
|
||||
/* X'-coordinate of intersection */
|
||||
0.0, /* LOS thickness of component */
|
||||
PHANTOM_ARMOR, /* component code number */
|
||||
space, /* space code */
|
||||
0.0, /* sine of fallback angle */
|
||||
0.0, /* rotation angle (degrees) */
|
||||
0.0 /* cosine of obliquity angle at entry */
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file!\n", outfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
if( shotlnfile[0] != NUL
|
||||
&& fprintf( shotlnfp,
|
||||
"%c % 8.2f % 7.3f % 7.3f %4d % 8.2f % 8.2f %2d % 7.2f % 7.2f\n",
|
||||
PS_SHOT_INTERSECT,
|
||||
(standoff-hitp->hit_dist)*unitconv,
|
||||
/* X'-coordinate of intersection */
|
||||
0.0, /* sine of fallback angle */
|
||||
0.0, /* rotation angle in degrees */
|
||||
PHANTOM_ARMOR, /* component code number */
|
||||
0.0, /* normal thickness of component */
|
||||
0.0, /* LOS thickness of component */
|
||||
space, /* space code */
|
||||
0.0, /* entry obliquity angle in degrees */
|
||||
0.0 /* exit obliquity angle in degrees */
|
||||
) < 0
|
||||
)
|
||||
{
|
||||
rt_log( "Write failed to file (%s)!\n", shotlnfile );
|
||||
locPerror( "fprintf" );
|
||||
exitCleanly( 1 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#include <varargs.h>
|
||||
/* VARARGS */
|
||||
void
|
||||
prntScr( fmt, va_alist )
|
||||
char *fmt;
|
||||
va_dcl
|
||||
{ va_list ap;
|
||||
va_start( ap );
|
||||
if( tty )
|
||||
{
|
||||
TcClrTabs( HmTtyFd );
|
||||
if( ScSetScrlReg( SCROLL_TOP, SCROLL_BTM ) )
|
||||
{
|
||||
(void) ScMvCursor( 1, SCROLL_BTM );
|
||||
(void) ScClrEOL();
|
||||
(void) _doprnt( fmt, ap, stdout );
|
||||
(void) ScClrScrlReg();
|
||||
}
|
||||
else
|
||||
if( ScDL != NULL )
|
||||
{
|
||||
(void) ScMvCursor( 1, SCROLL_TOP );
|
||||
(void) ScDeleteLn();
|
||||
(void) ScMvCursor( 1, SCROLL_BTM );
|
||||
(void) ScClrEOL();
|
||||
(void) _doprnt( fmt, ap, stdout );
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) _doprnt( fmt, ap, stdout );
|
||||
(void) fputs( "\n", stdout );
|
||||
}
|
||||
(void) fflush( stdout );
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) _doprnt( fmt, ap, stderr );
|
||||
(void) fputs( "\n", stderr );
|
||||
}
|
||||
va_end( ap );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void prntTimer( char *str )
|
||||
*/
|
||||
void
|
||||
prntTimer( str )
|
||||
char *str;
|
||||
{
|
||||
(void) rt_read_timer( timer, TIMER_LEN-1 );
|
||||
if( tty )
|
||||
{
|
||||
(void) ScMvCursor( TIMER_X, TIMER_Y );
|
||||
if( str == NULL )
|
||||
(void) printf( "%s", timer );
|
||||
else
|
||||
(void) printf( "%s:\t%s", str, timer );
|
||||
(void) ScClrEOL();
|
||||
(void) fflush( stdout );
|
||||
}
|
||||
else
|
||||
rt_log( "%s:\t%s\n", str == NULL ? "(null)" : str, timer );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
prntTitle( title )
|
||||
char *title;
|
||||
{
|
||||
if( ! tty || rt_g.debug )
|
||||
rt_log( "%s\n", title == NULL ? "(null)" : title );
|
||||
return;
|
||||
}
|
||||
|
||||
static char *usage[] =
|
||||
{
|
||||
"Usage: burst [-b]",
|
||||
"\tThe -b option suppresses the screen display (for batch jobs).",
|
||||
NULL
|
||||
};
|
||||
void
|
||||
prntUsage()
|
||||
{ register char **p = usage;
|
||||
while( *p != NULL )
|
||||
(void) fprintf( stderr, "%s\n", *p++ );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
prompt( str )
|
||||
char *str;
|
||||
{
|
||||
(void) ScMvCursor( PROMPT_X, PROMPT_Y );
|
||||
if( str == (char *) NULL )
|
||||
(void) ScClrEOL();
|
||||
else
|
||||
{
|
||||
(void) ScSetStandout();
|
||||
(void) fputs( str, stdout );
|
||||
(void) ScClrStandout();
|
||||
}
|
||||
(void) fflush( stdout );
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
qAdd( pp, qpp )
|
||||
struct partition *pp;
|
||||
Pt_Queue **qpp;
|
||||
{ Pt_Queue *newq;
|
||||
RES_ACQUIRE( &rt_g.res_syscall );
|
||||
if( (newq = (Pt_Queue *) malloc( sizeof(Pt_Queue) )) == PT_Q_NULL )
|
||||
{
|
||||
Malloc_Bomb( sizeof(Pt_Queue) );
|
||||
RES_RELEASE( &rt_g.res_syscall );
|
||||
return 0;
|
||||
}
|
||||
RES_RELEASE( &rt_g.res_syscall );
|
||||
newq->q_next = *qpp;
|
||||
newq->q_part = pp;
|
||||
*qpp = newq;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
qFree( qp )
|
||||
Pt_Queue *qp;
|
||||
{
|
||||
if( qp == PT_Q_NULL )
|
||||
return;
|
||||
qFree( qp->q_next );
|
||||
RES_ACQUIRE( &rt_g.res_syscall );
|
||||
free( (char *) qp );
|
||||
RES_RELEASE( &rt_g.res_syscall );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
warning( str )
|
||||
char *str;
|
||||
{
|
||||
if( tty )
|
||||
HmError( str );
|
||||
else
|
||||
prntScr( str );
|
||||
return;
|
||||
}
|
||||
-469
@@ -1,469 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
#define NDEBUG
|
||||
#define STATIC static
|
||||
#else
|
||||
#define STATIC
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "./burst.h"
|
||||
#include "./trie.h"
|
||||
#include "./ascii.h"
|
||||
#include "./extern.h"
|
||||
|
||||
STATIC Func *matchTrie();
|
||||
|
||||
/*
|
||||
Trie *addTrie( char *name, Trie **triepp )
|
||||
|
||||
Insert the name in the trie specified by triepp, if it
|
||||
doesn't already exist there.
|
||||
Return pointer to leaf node associated with name.
|
||||
*/
|
||||
Trie *
|
||||
addTrie( name, triepp )
|
||||
register char *name;
|
||||
register Trie **triepp;
|
||||
{ register Trie *curp;
|
||||
if( *name == NUL )
|
||||
{ /* End of name, see if name already exists. */
|
||||
if( *triepp == TRIE_NULL )
|
||||
{ /* Name does not exist, make leaf node. */
|
||||
NewTrie( *triepp );
|
||||
(*triepp)->l.t_altr = (*triepp)->l.t_next
|
||||
= TRIE_NULL;
|
||||
(*triepp)->l.t_func = FUNC_NULL;
|
||||
}
|
||||
else
|
||||
if( (*triepp)->n.t_next != TRIE_NULL )
|
||||
/* Name is subset of another name. */
|
||||
return addTrie( name, &(*triepp)->n.t_altr );
|
||||
/* else -- Name already inserted, so do nothing. */
|
||||
return *triepp;
|
||||
}
|
||||
/* Find matching letter, this level. */
|
||||
for( curp = *triepp;
|
||||
curp != TRIE_NULL && *name != curp->n.t_char;
|
||||
curp = curp->n.t_altr
|
||||
)
|
||||
;
|
||||
if( curp == TRIE_NULL )
|
||||
{ /* No Match, this level, so create new alternate. */
|
||||
curp = *triepp;
|
||||
NewTrie( *triepp );
|
||||
(*triepp)->n.t_altr = curp;
|
||||
(*triepp)->n.t_char = *name;
|
||||
(*triepp)->n.t_next = TRIE_NULL;
|
||||
return addTrie( ++name, &(*triepp)->n.t_next );
|
||||
}
|
||||
else
|
||||
/* Found matching character. */
|
||||
return addTrie( ++name, &curp->n.t_next );
|
||||
}
|
||||
|
||||
Func *
|
||||
getTrie( name, triep )
|
||||
register char *name;
|
||||
register Trie *triep;
|
||||
{ register Trie *curp;
|
||||
/* Traverse next links to end of region name. */
|
||||
for( ; triep != TRIE_NULL; triep = triep->n.t_next )
|
||||
{
|
||||
curp = triep;
|
||||
if( *name == NUL )
|
||||
{ /* End of user-typed name. */
|
||||
if( triep->n.t_altr != TRIE_NULL )
|
||||
/* Ambiguous at this point. */
|
||||
return FUNC_NULL;
|
||||
else /* Complete next character. */
|
||||
{
|
||||
*name++ = triep->n.t_char;
|
||||
*name = NUL;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( *name == '*' )
|
||||
return matchTrie( triep );
|
||||
else /* Not at end of user-typed name yet, traverse
|
||||
alternate list to find current letter.
|
||||
*/
|
||||
{
|
||||
for( ;
|
||||
triep != TRIE_NULL
|
||||
&& *name != triep->n.t_char;
|
||||
triep = triep->n.t_altr
|
||||
)
|
||||
;
|
||||
if( triep == TRIE_NULL )
|
||||
/* Non-existant name, truncate bad part. */
|
||||
{
|
||||
*name = NUL;
|
||||
return FUNC_NULL;
|
||||
}
|
||||
else
|
||||
name++;
|
||||
}
|
||||
}
|
||||
/* Clobber key-stroke, and return it. */
|
||||
--name;
|
||||
*name = NUL;
|
||||
return curp->l.t_func;
|
||||
}
|
||||
|
||||
#define MAX_TRIE_LEVEL (32*16)
|
||||
|
||||
STATIC Func *
|
||||
matchTrie( triep )
|
||||
register Trie *triep;
|
||||
{ Func *func;
|
||||
if( triep == TRIE_NULL )
|
||||
func = FUNC_NULL;
|
||||
else
|
||||
if( triep->n.t_altr != TRIE_NULL )
|
||||
func = FUNC_NULL; /* Ambiguous root, no match. */
|
||||
else
|
||||
if( triep->n.t_next == TRIE_NULL )
|
||||
func = triep->l.t_func; /* At leaf node, return datum. */
|
||||
else /* Keep going to leaf. */
|
||||
func = matchTrie( triep->n.t_next );
|
||||
return func;
|
||||
}
|
||||
|
||||
void
|
||||
prntTrie( triep, level )
|
||||
Trie *triep;
|
||||
int level;
|
||||
{ register Trie *tp = triep;
|
||||
static char name_buf[MAX_TRIE_LEVEL+1], *namep;
|
||||
#if DEBUG_TRIE
|
||||
rt_log( "prntTrie(triep=0x%x,level=%d)\n", triep, level );
|
||||
#endif
|
||||
if( tp == TRIE_NULL )
|
||||
return;
|
||||
if( tp->n.t_altr != TRIE_NULL )
|
||||
prntTrie( tp->n.t_altr, level );
|
||||
if( level == 0 )
|
||||
namep = name_buf;
|
||||
*namep = tp->n.t_char;
|
||||
if( tp->n.t_next == TRIE_NULL )
|
||||
{
|
||||
/* At end of name, so print it out. */
|
||||
*namep = NUL;
|
||||
rt_log( "%s\n", name_buf );
|
||||
}
|
||||
else
|
||||
{
|
||||
namep++;
|
||||
prntTrie( tp->n.t_next, level+1 );
|
||||
namep--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
writeTrie( triep, level, fp )
|
||||
Trie *triep;
|
||||
int level;
|
||||
FILE *fp;
|
||||
{ register Trie *tp = triep;
|
||||
static char name_buf[MAX_TRIE_LEVEL+1], *namep;
|
||||
if( tp == TRIE_NULL )
|
||||
return 1;
|
||||
if( tp->n.t_altr != TRIE_NULL )
|
||||
(void) writeTrie( tp->n.t_altr, level, fp );
|
||||
if( level == 0 )
|
||||
namep = name_buf;
|
||||
*namep = tp->n.t_char;
|
||||
if( tp->n.t_next == TRIE_NULL )
|
||||
{
|
||||
/* At end of name, so print it out. */
|
||||
*namep = NUL;
|
||||
(void) fprintf( fp, "%s\n", name_buf );
|
||||
}
|
||||
else
|
||||
{
|
||||
namep++;
|
||||
(void) writeTrie( tp->n.t_next, level+1, fp );
|
||||
namep--;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
readTrie( fp, triepp )
|
||||
FILE *fp;
|
||||
Trie **triepp;
|
||||
{ static char name_buf[MAX_TRIE_LEVEL+1];
|
||||
while( fgets( name_buf, MAX_TRIE_LEVEL, fp ) != NULL )
|
||||
{
|
||||
name_buf[strlen(name_buf)-1] = '\0'; /* Clobber new-line. */
|
||||
(void) addTrie( name_buf, triepp );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
ring_Bell()
|
||||
{
|
||||
(void) putchar( BEL );
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
char_To_String( i )
|
||||
int i;
|
||||
{ static char buf[4];
|
||||
if( i >= SP && i < DEL )
|
||||
{
|
||||
buf[0] = i;
|
||||
buf[1] = NUL;
|
||||
}
|
||||
else
|
||||
if( i >= NUL && i < SP )
|
||||
{
|
||||
buf[0] = '^';
|
||||
buf[1] = i + 64;
|
||||
buf[2] = NUL;
|
||||
}
|
||||
else
|
||||
if( i == DEL )
|
||||
return "DL";
|
||||
else
|
||||
return "EOF";
|
||||
return buf;
|
||||
}
|
||||
|
||||
#if false
|
||||
/*
|
||||
Func *getFuncNm( char *inbuf, int bufsz, char *msg, Trie **triepp )
|
||||
TENEX-style name completion.
|
||||
Returns a function pointer.
|
||||
*/
|
||||
Func *
|
||||
getFuncNm( inbuf, bufsz, msg, triepp )
|
||||
char *inbuf;
|
||||
int bufsz;
|
||||
char *msg;
|
||||
Trie **triepp;
|
||||
{ static char buffer[BUFSIZ];
|
||||
register char *p = buffer;
|
||||
register int c;
|
||||
Func *funcp;
|
||||
if( tty )
|
||||
{
|
||||
save_Tty( 0 );
|
||||
set_Raw( 0 );
|
||||
clr_Echo( 0 );
|
||||
}
|
||||
prompt( msg );
|
||||
*p = NUL;
|
||||
do
|
||||
{
|
||||
(void) fflush( stdout );
|
||||
c = hm_getchar();
|
||||
switch( c )
|
||||
{
|
||||
case SP :
|
||||
{
|
||||
if( *triepp == TRIE_NULL
|
||||
|| (funcp = getTrie( buffer, *triepp ))
|
||||
== FUNC_NULL
|
||||
)
|
||||
(void) putchar( BEL );
|
||||
for( ; p > buffer; p-- )
|
||||
(void) putchar( BS );
|
||||
(void) printf( "%s", buffer );
|
||||
(void) ClrEOL();
|
||||
(void) fflush( stdout );
|
||||
p += strlen( buffer );
|
||||
break;
|
||||
}
|
||||
case Ctrl('A') : /* Cursor to beginning of line. */
|
||||
if( p == buffer )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
for( ; p > buffer; p-- )
|
||||
(void) putchar( BS );
|
||||
break;
|
||||
case Ctrl('B') :
|
||||
case BS : /* Move cursor back one character. */
|
||||
if( p == buffer )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
(void) putchar( BS );
|
||||
--p;
|
||||
break;
|
||||
case Ctrl('D') : /* Delete character under cursor. */
|
||||
{ register char *q = p;
|
||||
if( *p == NUL )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
for( ; *q != NUL; ++q )
|
||||
{
|
||||
*q = *(q+1);
|
||||
(void) putchar( *q != NUL ? *q : SP );
|
||||
}
|
||||
for( ; q > p; --q )
|
||||
(void) putchar( BS );
|
||||
break;
|
||||
}
|
||||
case Ctrl('E') : /* Cursor to end of line. */
|
||||
if( *p == NUL )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
(void) printf( "%s", p );
|
||||
p += strlen( p );
|
||||
break;
|
||||
case Ctrl('F') : /* Cursor forward one character. */
|
||||
if( *p == NUL || p-buffer >= bufsz-2 )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
(void) putchar( *p++ );
|
||||
break;
|
||||
case Ctrl('G') : /* Abort input. */
|
||||
ring_Bell();
|
||||
notify( "Aborted.", NOTIFY_APPEND );
|
||||
goto clean_return;
|
||||
case Ctrl('K') : /* Erase from cursor to end of line. */
|
||||
if( *p == NUL )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
ClrEOL();
|
||||
*p = NUL;
|
||||
break;
|
||||
case Ctrl('P') : /* Yank previous contents of "inbuf". */
|
||||
{ register int len = strlen( inbuf );
|
||||
if( (p + len) - buffer >= BUFSIZ )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
(void) strncpy( p, inbuf, bufsz );
|
||||
(void) printf( "%s", p );
|
||||
p += len;
|
||||
break;
|
||||
}
|
||||
case Ctrl('U') : /* Erase from start of line to cursor. */
|
||||
if( p == buffer )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
for( ; p > buffer; --p )
|
||||
{ register char *q = p;
|
||||
(void) putchar( BS );
|
||||
for( ; *(q-1) != NUL; ++q )
|
||||
{
|
||||
*(q-1) = *q;
|
||||
(void) putchar( *q != NUL ? *q : SP );
|
||||
}
|
||||
for( ; q > p; --q )
|
||||
(void) putchar( BS );
|
||||
}
|
||||
break;
|
||||
case Ctrl('R') : /* Print line, cursor doesn't move. */
|
||||
{ register int i;
|
||||
if( buffer[0] == NUL )
|
||||
break;
|
||||
for( i = p - buffer; i > 0; i-- )
|
||||
(void) putchar( BS );
|
||||
(void) printf( "%s", buffer );
|
||||
for( i = strlen( buffer ) - (p - buffer); i > 0; i-- )
|
||||
(void) putchar( BS );
|
||||
break;
|
||||
}
|
||||
case DEL : /* Delete character behind cursor. */
|
||||
{ register char *q = p;
|
||||
if( p == buffer )
|
||||
{
|
||||
ring_Bell();
|
||||
break;
|
||||
}
|
||||
(void) putchar( BS );
|
||||
for( ; *(q-1) != NUL; ++q )
|
||||
{
|
||||
*(q-1) = *q;
|
||||
(void) putchar( *q != NUL ? *q : SP );
|
||||
}
|
||||
for( ; q > p; --q )
|
||||
(void) putchar( BS );
|
||||
p--;
|
||||
break;
|
||||
}
|
||||
case CR :
|
||||
case LF :
|
||||
case EOF :
|
||||
if( *triepp == TRIE_NULL
|
||||
|| (funcp = getTrie( buffer, *triepp ))
|
||||
== FUNC_NULL
|
||||
)
|
||||
{
|
||||
(void) putchar( BEL );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) strncpy( inbuf, buffer, bufsz );
|
||||
notify( NULL, NOTIFY_DELETE );
|
||||
goto clean_return;
|
||||
}
|
||||
case Ctrl('V') :
|
||||
/* Escape character, do not process next char. */
|
||||
c = hm_getchar();
|
||||
/* Fall through to default case! */
|
||||
default : /* Insert character at cursor. */
|
||||
{ register char *q = p;
|
||||
register int len = strlen( p );
|
||||
/* Scroll characters forward. */
|
||||
if( c >= NUL && c < SP )
|
||||
(void) printf( "%s", char_To_String( c ) );
|
||||
else
|
||||
(void) putchar( c );
|
||||
for( ; len >= 0; len--, q++ )
|
||||
(void) putchar( *q == NUL ? SP : *q );
|
||||
for( ; q > p; q-- )
|
||||
{
|
||||
(void) putchar( BS );
|
||||
*q = *(q-1);
|
||||
}
|
||||
*p++ = c;
|
||||
break;
|
||||
}
|
||||
} /* End switch. */
|
||||
}
|
||||
while( strlen( buffer ) < BUFSIZ);
|
||||
ring_Bell();
|
||||
notify( "Buffer full.", NOTIFY_APPEND );
|
||||
clean_return :
|
||||
prompt( "" );
|
||||
if( tty )
|
||||
reset_Tty( 0 );
|
||||
return funcp;
|
||||
}
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6651 or AV-298-6651
|
||||
|
||||
$Header$ (BRL)
|
||||
*/
|
||||
#ifndef INCL_TRIE
|
||||
#define INCL_TRIE
|
||||
|
||||
#ifdef FUNC_NULL
|
||||
#undef FUNC_NULL
|
||||
#endif
|
||||
|
||||
#define FUNC_NULL ((Func *) NULL)
|
||||
#define TRIE_NULL ((Trie *) NULL)
|
||||
|
||||
/* Datum for trie leaves. */
|
||||
typedef void Func();
|
||||
|
||||
/* Trie tree node. */
|
||||
typedef union trie Trie;
|
||||
union trie
|
||||
{
|
||||
struct /* Internal nodes: datum is current letter. */
|
||||
{
|
||||
int t_char; /* Current letter. */
|
||||
Trie *t_altr; /* Alternate letter node link. */
|
||||
Trie *t_next; /* Next letter node link. */
|
||||
}
|
||||
n;
|
||||
struct /* Leaf nodes: datum is function ptr. */
|
||||
{
|
||||
Func *t_func; /* Function pointer. */
|
||||
Trie *t_altr; /* Alternate letter node link. */
|
||||
Trie *t_next; /* Next letter node link. */
|
||||
}
|
||||
l;
|
||||
};
|
||||
#define NewTrie( p ) \
|
||||
if( ((p) = (Trie *) malloc( sizeof(Trie) )) == TRIE_NULL )\
|
||||
{\
|
||||
Malloc_Bomb(sizeof(Trie));\
|
||||
return TRIE_NULL;\
|
||||
}
|
||||
extern Trie *cmd_trie;
|
||||
#endif /* INCL_TRIE */
|
||||
-1616
File diff suppressed because it is too large
Load Diff
-100
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
Author: Gary S. Moss
|
||||
U. S. Army Ballistic Research Laboratory
|
||||
Aberdeen Proving Ground
|
||||
Maryland 21005-5066
|
||||
(301)278-6647 or AV-298-6647
|
||||
$Header$
|
||||
*/
|
||||
#ifndef _POLY9
|
||||
#include <math.h>
|
||||
#endif
|
||||
#ifndef Abs
|
||||
#define Abs( a ) ((a) > 0 ? (a) : -(a))
|
||||
#endif
|
||||
#define AbsDotProd( A, B ) (Abs( Dot( A, B ) ))
|
||||
#define AddVec( A, B ) { (A)[X] += (B)[X]; \
|
||||
(A)[Y] += (B)[Y]; \
|
||||
(A)[Z] += (B)[Z]; }
|
||||
#define Add2Vec( A, B, C ) { (C)[X] = (A)[X]+(B)[X]; \
|
||||
(C)[Y] = (A)[Y]+(B)[Y]; \
|
||||
(C)[Z] = (A)[Z]+(B)[Z]; }
|
||||
#define AproxEq( a, b, e ) (Abs( (a)-(b) ) < (e))
|
||||
#define AproxEqVec( A, B, e ) ( AproxEq((A)[X],(B)[X],(e)) && \
|
||||
AproxEq((A)[Y],(B)[Y],(e)) && \
|
||||
AproxEq((A)[Z],(B)[Z],(e)) )
|
||||
#define CopyVec( A, B ) { (A)[X] = (B)[X]; \
|
||||
(A)[Y] = (B)[Y]; \
|
||||
(A)[Z] = (B)[Z]; }
|
||||
#define CrossProd( A, B, C ) { (C)[X] = (A)[Y]*(B)[Z]-(A)[Z]*(B)[Y]; \
|
||||
(C)[Y] = (A)[Z]*(B)[X]-(A)[X]*(B)[Z]; \
|
||||
(C)[Z] = (A)[X]*(B)[Y]-(A)[Y]*(B)[X]; }
|
||||
#define DEGRAD 57.2957795130823208767981548141051703324054724665642
|
||||
/* degrees per radian */
|
||||
#define DiffVec( A, B ) { (A)[X] -= (B)[X]; \
|
||||
(A)[Y] -= (B)[Y]; \
|
||||
(A)[Z] -= (B)[Z]; }
|
||||
#define Diff2Vec( A, B, C ) { (C)[X] = (A)[X]-(B)[X]; \
|
||||
(C)[Y] = (A)[Y]-(B)[Y]; \
|
||||
(C)[Z] = (A)[Z]-(B)[Z]; }
|
||||
#define Dist3d( A, B ) (sqrt( Sqr((A)[X]-(B)[X])+\
|
||||
Sqr((A)[Y]-(B)[Y])+\
|
||||
Sqr((A)[Z]-(B)[Z]))\
|
||||
)
|
||||
#define DivideVec( A, S ) { (A)[X] /= (S); \
|
||||
(A)[Y] /= (S); \
|
||||
(A)[Z] /= (S); }
|
||||
#define Dot( A, B ) ((A)[X]*(B)[X]+(A)[Y]*(B)[Y]+(A)[Z]*(B)[Z])
|
||||
#ifndef EPSILON
|
||||
#define EPSILON 0.000001
|
||||
#endif
|
||||
#define Expand_Vec_Int( V ) (int)(V)[X], (int)(V)[Y], (int)(V)[Z]
|
||||
#define LOG10E 0.43429448190325182765112891891660508229439700580367
|
||||
/* log of e to the base 10 */
|
||||
#define Mag( A ) sqrt( AbsDotProd(A,A) )
|
||||
#define Mag3(a1,a2,a3) (sqrt(Sqr(a1)+Sqr(a2)+Sqr(a3)))
|
||||
#ifndef Min
|
||||
#define Min( a, b ) ((a) < (b) ? (a) : (b))
|
||||
#define Max( a, b ) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
#define MinMax( m, M, a ) { m = Min( m, a ); M = Max( M, a ); }
|
||||
#define MinMaxVec( A, B, C ) { (A)[X] = Min( (A)[X], (C)[X] ); \
|
||||
(A)[Y] = Min( (A)[Y], (C)[Y] ); \
|
||||
(A)[Z] = Min( (A)[Z], (C)[Z] ); \
|
||||
(B)[X] = Max( (B)[X], (C)[X] ); \
|
||||
(B)[Y] = Max( (B)[Y], (C)[Y] ); \
|
||||
(B)[Z] = Max( (B)[Z], (C)[Z] ); }
|
||||
#define NearZero( a ) ((a) < EPSILON && (a) > -EPSILON)
|
||||
#define NonZeroVec( V ) (!NearZero((V)[X]) || !NearZero((V)[Y])|| !NearZero((V)[Z]))
|
||||
#define PI 3.14159265358979323846264338327950288419716939937511
|
||||
/* ratio of circumf. to diam. */
|
||||
#define RelDist3d( A, B ) (Sqr((A)[X]-(B)[X])+\
|
||||
Sqr((A)[Y]-(B)[Y])+\
|
||||
Sqr((A)[Z]-(B)[Z]))
|
||||
#define ScaleVec( A, s ) { (A)[X] *= (s); \
|
||||
(A)[Y] *= (s); \
|
||||
(A)[Z] *= (s); }
|
||||
#define Scale2Vec( A, s, B ) { (B)[X] = (A)[X] * (s); \
|
||||
(B)[Y] = (A)[Y] * (s); \
|
||||
(B)[Z] = (A)[Z] * (s); }
|
||||
#define Sqr(a) ((a)*(a))
|
||||
#define TWO_PI 6.28318530717958647692528676655900576839433879875022
|
||||
/* Scale vector 'a' to have magnitude 'l'. */
|
||||
#define V_Length( a, l ) \
|
||||
{ double f, m; \
|
||||
if( (m=Mag(a)) == 0.0 ) \
|
||||
rt_log( "Magnitude is zero!\n" ); \
|
||||
else \
|
||||
{ \
|
||||
f = (l)/m; \
|
||||
(a)[X] *= f; (a)[Y] *= f; (a)[Z] *= f; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define V_Print(a,b,func) \
|
||||
func( "%s\t<%12.6f,%12.6f,%12.6f>\n", a, (b)[0], (b)[1], (b)[2] )
|
||||
#ifndef X
|
||||
#define X 0
|
||||
#define Y 1
|
||||
#define Z 2
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
Cake copying permission notice Copyright (C) 1987 Zoltan Somogyi
|
||||
|
||||
Cake is distributed in the hope that it will be useful, but without any
|
||||
warranty. No author or distributor accepts responsibility to anyone for
|
||||
the consequences of using it or for whether it serves any particular purpose
|
||||
or works at all, unless he/she says so in writing.
|
||||
|
||||
Everyone is granted permission to copy, modify and redistribute Cake
|
||||
under the following conditions:
|
||||
|
||||
Permission is granted to anyone to make or distribute verbatim copies
|
||||
of Cake source code as received, in any medium, provided that all
|
||||
copyright notices and permission and nonwarranty notices are preserved,
|
||||
and that the distributor grants the recipient permission for further
|
||||
redistribution as permitted by this document, and gives him/her and
|
||||
points out to him/her an exact copy of this document to inform him/her
|
||||
of his/her rights.
|
||||
|
||||
Permission is granted to distribute modified versions of Cake source
|
||||
code, or of portions of it, under the above conditions, provided also
|
||||
that all changed files carry prominent notices stating who last changed
|
||||
them and that all the Cake-derived material, including everything
|
||||
packaged together with it and not independently usable, is distributed
|
||||
under the conditions stated in this document.
|
||||
|
||||
Permission is granted to distribute Cake in compiled or executable form
|
||||
under the same conditions applying for source code, provided that either
|
||||
|
||||
A it is accompanied by the corresponding machine-readable source
|
||||
code, or
|
||||
B it is accompanied by a written offer, with no time limit, to
|
||||
give anyone a machine-readable copy of the corresponding source
|
||||
code in return for reimbursement of the cost of distribution.
|
||||
This written offer must permit verbatim duplication by anyone.
|
||||
C it is distributed by someone who received only the executable
|
||||
form, and is accompanied by a copy of the written offer of
|
||||
source code which he/she received along with it.
|
||||
|
||||
In other words, you are welcome to use, share and improve Cake.
|
||||
You are forbidden to forbid anyone else to use, share and improve
|
||||
what you give them. Help stamp out software-hoarding!
|
||||
|
||||
This copyright notice was adapted from the one supplied with GNU Emacs.
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
# Makefile for Cake
|
||||
#
|
||||
#$Header$
|
||||
SHELL=/bin/sh
|
||||
|
||||
# -DATT for SystemV, -DBSD for Berkeley, done by machinetype.sh
|
||||
#
|
||||
# For Apollo, may need to add -Tbsd4.3
|
||||
COPTS = -DCAKEDEBUG -DYYDEBUG -DCAREFUL -D`machinetype.sh -a`
|
||||
|
||||
BINDIR=/usr/brlcad/bin
|
||||
|
||||
#LDFLAGS=-k 64k
|
||||
|
||||
HDR = cake.h conf.h port.h
|
||||
SRC = act.c chase.c entry.c error.c expand.c file.c \
|
||||
list.c main.c make.c mem.c pat.c print.c proc.c \
|
||||
sym.c sys.c table.c test.c trail.c
|
||||
OBJ = act.o chase.o entry.o error.o expand.o file.o \
|
||||
list.o main.o make.o mem.o pat.o print.o proc.o \
|
||||
sym.o sys.o table.o test.o trail.o
|
||||
GEN = cake_g.y cake_s.l
|
||||
GHDR = cake_g.h
|
||||
GSRC = cake_g.c cake_s.c
|
||||
GOBJ = cake_g.o cake_s.o
|
||||
|
||||
CFLAGS= $(COPTS)
|
||||
|
||||
cake: $(OBJ) $(GOBJ)
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o cake $(OBJ) $(GOBJ)
|
||||
# -/bin/rm fake
|
||||
# ln cake fake
|
||||
|
||||
all: cake lint tags
|
||||
|
||||
install: cake
|
||||
-if test -f $(BINDIR)/cake; then \
|
||||
mv -f $(BINDIR)/cake $(BINDIR)/cake.bak; fi
|
||||
mv cake $(BINDIR)/cake
|
||||
|
||||
$(OBJ): $(HDR)
|
||||
$(GOBJ): $(HDR)
|
||||
|
||||
cake_g.c: cake_g.y
|
||||
yacc -dv cake_g.y
|
||||
mv -f y.tab.h cake_g.h
|
||||
mv -f y.tab.c cake_g.c
|
||||
mv -f y.output cake_g.t
|
||||
|
||||
cake_s.c: cake_s.l
|
||||
lex cake_s.l
|
||||
mv -f lex.yy.c cake_s.c
|
||||
|
||||
var: $(SRC) $(GSRC)
|
||||
var -DATT $(COPTS) $(SRC) $(GSRC) > Var
|
||||
|
||||
plint: $(SRC) $(GSRC)
|
||||
lint -acpx $(COPTS) $(SRC) $(GSRC) > Lint_errs
|
||||
|
||||
ulint: $(SRC) $(GSRC)
|
||||
lint -v $(COPTS) $(SRC) $(GSRC) > Lint_errs
|
||||
|
||||
lint: $(SRC) $(GSRC)
|
||||
lint -v $(COPTS) $(SRC) $(GSRC) > Lint_errs
|
||||
@gred yy Lint_errs
|
||||
@gred malloc Lint_errs
|
||||
@gred strcpy Lint_errs
|
||||
@gred strcat Lint_errs
|
||||
@gred printf Lint_errs
|
||||
@gred flsbuf Lint_errs
|
||||
@gred setbuf Lint_errs
|
||||
@gred rcs_id Lint_errs
|
||||
@gred longjmp Lint_errs
|
||||
@gred sbrk Lint_errs
|
||||
|
||||
cchk: $(SRC)
|
||||
cchk $(SRC) > Cchk_errs
|
||||
|
||||
tags: $(SRC) $(GSRC)
|
||||
ctags $(SRC) $(GSRC)
|
||||
|
||||
cxref: $(SRC)
|
||||
cxref -C $(SRC) > Cxref
|
||||
|
||||
ssize:
|
||||
ssize $(SRC) $(GEN)
|
||||
|
||||
asize:
|
||||
ssize $(SRC) $(GEN) $(GSRC)
|
||||
|
||||
clean:
|
||||
/bin/rm -f cake_g.h cake_g.t \
|
||||
Make_errs Lint_errs Cchk_errs core \
|
||||
$(OBJ) $(GOBJ) $(GSRC)
|
||||
|
||||
gclean:
|
||||
/bin/rm -f $(GSRC) $(GHDR)
|
||||
|
||||
clobber: clean
|
||||
/bin/rm -f cake fake
|
||||
-121
@@ -1,121 +0,0 @@
|
||||
This is the root directory of the cake distribution.
|
||||
|
||||
This directory contains the sources for the cake command itself.
|
||||
Its subdirectories contain sources for commands used by the standard
|
||||
cakefiles (Aux), diffs for a modified version of the lex driver (Lex),
|
||||
"standard" cakefiles (Lib), manuals and a paper on cake (Man), and
|
||||
commands implemented by scripts (Script). Each subdirectory contains
|
||||
its own README file; you should have a look at them. The rest of this
|
||||
file is just for the cake source.
|
||||
|
||||
Cake was developed on a 3240 under 4.2BSD Unix, with an early version
|
||||
on a Pyramid 90x (in the Berkeley universe). It has been tested on a
|
||||
VAX-11/780 under 4.3BSD, on a Sun under SunOS 3.4, and on an ELXSI 6400
|
||||
under both 4.2BSD and System V. It should also be portable to other
|
||||
configurations. Its parameters are concentrated in the Makefile and
|
||||
in conf.h, but you should have a look at Lex/README *before* you run
|
||||
"make install".
|
||||
|
||||
Makefile:
|
||||
|
||||
The four make variables you should have a look at and maybe change
|
||||
are DEST, COPTS, CFLAGS, and LDFLAGS. DEST and CFLAGS should be
|
||||
self-explanatory. LDFLAGS as it is just sets the max stack size
|
||||
on the 3240 (a segmented non-paged machine) - on other machines
|
||||
an empy LDFLAGS should do just fine. The macros you can choose from
|
||||
for COPTS are:
|
||||
|
||||
ATT is for AT&T variants of Unix. Cake has not been tested extensively
|
||||
for these, but it has been in use for a while now on an Elxsi 6400
|
||||
running Enix, a System V port. Defining ATT shortens variable names
|
||||
to ensure that all are unique in the first six characters (see port.h)
|
||||
and that no two variable names differ only in case. This effect depends
|
||||
on the C preprocessor being able to handle long case-sensitive variable
|
||||
names, even if the compiler/loader can't handle them. Defining ATT makes
|
||||
cake call System V system calls instead of Berkeley ones, and does a few
|
||||
other things as well. It may or may not work for System III.
|
||||
|
||||
CAKEDEBUG, when defined, enables cake to output debugging information
|
||||
of various kinds, either on abnormal termination or in response to
|
||||
debugging options (see main.c). The option -Y requires YYDEBUG
|
||||
to debug the parser actions.
|
||||
|
||||
CAREFUL is a safety feature. It prevents cake from removing user files,
|
||||
even when its semantics call for it (see the -G option). It moves files
|
||||
to /tmp instead. This can slow cake down, so if you think it is not
|
||||
necessary (e.g. because you have used cake long enough to be confident
|
||||
that it will not delete files it should not delete or because you do
|
||||
frequent backups) you should not define CAREFUL.
|
||||
|
||||
EXTRACHECK is another safety feature - it enables extra internal
|
||||
consistency checks. These are fairly cheap, so you may keep them
|
||||
unless you are hurting for CPU time. The one specific instance you
|
||||
may want to delete is the one in mem.c which checks the aligment
|
||||
of malloc returns.
|
||||
|
||||
If you are concerned about memory usage, you may want to define MEMUSED,
|
||||
without which cake never free()s space. However, the opportunities for
|
||||
savings are minimal (really!); and you should also keep in mind that
|
||||
cake has never been tested with MEMUSED.
|
||||
|
||||
conf.h:
|
||||
|
||||
Cast should be a type to which all kinds of pointers can be converted
|
||||
forward and back without loss. On most machines int will do.
|
||||
|
||||
SLIB is the directory containing the "standard" systemwide library
|
||||
(which is in the Lib subdirectory in the distribution), while ULIB
|
||||
is the suffix (after $HOME) of people's own cake library.
|
||||
|
||||
CPP is the command to invoke the C preprocessor.
|
||||
|
||||
STATS_FILE is the name of the file in which each invocation of cake
|
||||
puts statistics. If you don't define STATS_FILE, cake does not keep
|
||||
any stats. If you do, the stats are reported (nicely formatted)
|
||||
by Script/{cs,ccs}.
|
||||
|
||||
Cake parses and execs normal (non-script) actions by itself if they
|
||||
don't contain any chars from the macro METACHARS. If they do, cake
|
||||
calls SYSTEM_CMD, while it calls SCRIPT_CMD for scripts. The arg
|
||||
to SYSTEM_CMD is the command itself, while the arg to SCRIPT_CMD
|
||||
is the name of a file (in /tmp) which contains the script. To convert
|
||||
to the Bourne shell, change csh to sh and delete the -f flags.
|
||||
For other shells, you will have to find out how to get equivalent
|
||||
behaviour, but keep in mind that Unix restricts you to zero or one
|
||||
arguments.
|
||||
|
||||
For ATT systems, TIMERES is the resulotion of the times() system call,
|
||||
but this is used only for stats.
|
||||
|
||||
GENESIS is just a time() value used internally for time when there is
|
||||
none applicable. It doesn't really matter what it is, as long as it
|
||||
precedes all valid values.
|
||||
|
||||
CHASEROOT is also a name used only internally - it too could be anything
|
||||
as long as it does not conflict with real filenames.
|
||||
|
||||
The other macros in conf.h define the (maximum) sizes of various kinds
|
||||
of things. You need to check only CHARSETSIZE, which should be 512 for
|
||||
9-bit byte systems. You should enlarge the others when somebody gets
|
||||
a bounds exceeded message.
|
||||
|
||||
Conditions:
|
||||
|
||||
The copying conditions for the cake distribution are in the file
|
||||
COPYING. It is patterned after the copying conditions of GNU,
|
||||
in particular GNU Emacs. Basically, you can do anything with it
|
||||
except prevent other people from getting access to it. This
|
||||
means that you can't sell it. For the reasons for these conditions,
|
||||
read Stallman's GNU manifesto.
|
||||
|
||||
Author:
|
||||
|
||||
Zoltan Somogyi
|
||||
|
||||
Department of Computer Science
|
||||
University of Melbourne
|
||||
Parkville, 3052 Victoria, Australia
|
||||
|
||||
UUCP: {uunet,mcvax,ukc}!munnari.oz!zs
|
||||
ARPA: zs%munnari.oz@uunet.uu.net
|
||||
CSNET: zs%munnari.oz@australia
|
||||
-671
@@ -1,671 +0,0 @@
|
||||
/*
|
||||
** Module to execute Cake actions.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** Update the node by executing the attached actions.
|
||||
** Actually, all the buddies will be updated, and
|
||||
** no action will be executed unless it is necessary.
|
||||
**
|
||||
** The level of a file is one greater than the level of its
|
||||
** parent in the chase graph; the level of !MAINCAKE! is 0.
|
||||
** This controls the printing of messages about the primary
|
||||
** targets.
|
||||
*/
|
||||
|
||||
update(node, level, force_exec)
|
||||
reg Node *node;
|
||||
reg int level;
|
||||
reg bool force_exec;
|
||||
{
|
||||
extern get_utime();
|
||||
extern save_novol();
|
||||
extern bool diff_novol();
|
||||
extern Wait carry_out();
|
||||
extern char *list_names();
|
||||
reg Node *bnode, *onode;
|
||||
reg List *ptr, *ptr1;
|
||||
reg bool oksofar, needact, mayskip;
|
||||
reg List *errnodes;
|
||||
Wait code;
|
||||
|
||||
put_trail("update", "start");
|
||||
cdebug("hunting %s at level %d\n", node->n_name, level);
|
||||
|
||||
/* force printing of "up-to-date" messages */
|
||||
if (level == 0 && is_ok(node))
|
||||
node->n_kind = n_CANDO;
|
||||
|
||||
if (off_node(node, nf_ERR) && is_ok(node))
|
||||
{
|
||||
cdebug("everything a-ok, nothing to do\n");
|
||||
if (level == 1)
|
||||
{
|
||||
if (on_node(node, nf_ORIG))
|
||||
{
|
||||
printf("cake: target %s has no ancestors\n", node->n_name);
|
||||
node->n_kind = n_NOWAY;
|
||||
}
|
||||
or (! xflag)
|
||||
printf("cake: %s is up to date\n", node->n_name);
|
||||
}
|
||||
|
||||
put_trail("update", "finish");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug)
|
||||
{
|
||||
printf("level %d starting update of\n", level);
|
||||
print_node(node);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (on_node(node, nf_ERR))
|
||||
{
|
||||
trace_errs(node);
|
||||
return;
|
||||
}
|
||||
|
||||
errnodes = NULL;
|
||||
|
||||
/* skip the actions if they are useless or not needed */
|
||||
oksofar = TRUE;
|
||||
needact = FALSE;
|
||||
mayskip = FALSE;
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
|
||||
if (on_node(bnode, nf_ERR))
|
||||
{
|
||||
oksofar = FALSE;
|
||||
errnodes = addtail(errnodes, bnode);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (off_node(bnode, nf_EXIST) || bnode->n_rtime < bnode->n_utime)
|
||||
needact = TRUE;
|
||||
|
||||
if (on_node(bnode, nf_DEPNONVOL))
|
||||
mayskip = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (! oksofar)
|
||||
{
|
||||
cdebug("error in buddies\n");
|
||||
if (vflag && strdiff(node->n_name, CHASEROOT))
|
||||
{
|
||||
sprintf(scratchbuf, "cannot proceed with update of %s because of problems with %s %s",
|
||||
node->n_name, (length(errnodes) == 1)? "buddy": "buddies", list_names(errnodes));
|
||||
add_error(node, new_name(scratchbuf), errnodes, TRUE);
|
||||
trace_errs(node);
|
||||
}
|
||||
|
||||
goto endit;
|
||||
}
|
||||
|
||||
if (! needact)
|
||||
{
|
||||
cdebug("no need for actions\n");
|
||||
if (strdiff(node->n_name, CHASEROOT))
|
||||
printf("cake: %s is up to date\n", node->n_name);
|
||||
|
||||
goto endit;
|
||||
}
|
||||
|
||||
/* update all ancestors of all buddies */
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
for_list (ptr1, bnode->n_old)
|
||||
{
|
||||
onode = (Node *) ldata(ptr1);
|
||||
update(onode, level+1, force_exec);
|
||||
if (on_node(onode, nf_ERR) || ! is_ok(onode))
|
||||
{
|
||||
oksofar = FALSE;
|
||||
errnodes = addtail(errnodes, onode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* skip the actions if any ancestors are missing */
|
||||
if (! oksofar)
|
||||
{
|
||||
cdebug("error in prerequisites\n");
|
||||
if (vflag && strdiff(node->n_name, CHASEROOT))
|
||||
{
|
||||
sprintf(scratchbuf, "cannot proceed with update of %s because of problems with %s %s",
|
||||
node->n_name, (length(errnodes) == 1)? "ancestor": "ancestors", list_names(errnodes));
|
||||
add_error(node, new_name(scratchbuf), errnodes, TRUE);
|
||||
trace_errs(node);
|
||||
}
|
||||
|
||||
goto endit;
|
||||
}
|
||||
|
||||
/* skip the actions; node is a missing base file */
|
||||
if (is_noway(node))
|
||||
{
|
||||
cdebug("error in planning\n");
|
||||
trace_errs(node);
|
||||
goto endit;
|
||||
}
|
||||
|
||||
/* find any NOWAY buddies; these may have n_old == [] */
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
if (is_noway(bnode))
|
||||
{
|
||||
oksofar = FALSE;
|
||||
errnodes = addtail(errnodes, bnode);
|
||||
}
|
||||
}
|
||||
|
||||
/* skip the actions if there are any NOWAY buddies */
|
||||
if (! oksofar)
|
||||
{
|
||||
cdebug("error in buddy planning\n");
|
||||
sprintf(scratchbuf, "dare not update %s because of possible effects on %s %s", node->n_name,
|
||||
(length(errnodes) == 1)? "buddy": "buddies", list_names(errnodes));
|
||||
add_error(node, new_name(scratchbuf), LNULL, TRUE);
|
||||
trace_errs(node);
|
||||
goto endit;
|
||||
}
|
||||
|
||||
/* reevaluate the necessity to act in the light of the */
|
||||
/* actions taken to update possibly nonvolatile ancestors */
|
||||
if (mayskip)
|
||||
{
|
||||
needact = FALSE; /* assume so for the moment */
|
||||
cdebug("deciding whether to skip\n");
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
|
||||
if (on_node(bnode, nf_DEPNONVOL))
|
||||
{
|
||||
cdebug("considering %s\n", bnode->n_name);
|
||||
get_utime(bnode, FALSE);
|
||||
}
|
||||
|
||||
if (off_node(bnode, nf_EXIST) || bnode->n_rtime < bnode->n_utime)
|
||||
{
|
||||
cdebug("%s needs action\n", bnode->n_name);
|
||||
needact = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! needact)
|
||||
{
|
||||
cdebug("no need for actions after all\n");
|
||||
if (strdiff(node->n_name, CHASEROOT))
|
||||
printf("cake: %s is up to date\n", node->n_name);
|
||||
|
||||
goto endit;
|
||||
}
|
||||
|
||||
if (tflag)
|
||||
{
|
||||
/* instead of action just touch the targets */
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
if (on_node(bnode, nf_PSEUDO))
|
||||
continue;
|
||||
|
||||
if (rflag)
|
||||
cake_utimes(bnode, bnode->n_utime);
|
||||
else
|
||||
cake_utimes(bnode, GENESIS);
|
||||
|
||||
printf("touch %s\n", bnode->n_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* prepare for actions */
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
if (on_node(bnode, nf_NONVOL))
|
||||
save_novol(bnode);
|
||||
}
|
||||
|
||||
/* execute actions */
|
||||
code = carry_out(node, force_exec);
|
||||
if (code.w_status != 0)
|
||||
{
|
||||
oksofar = FALSE;
|
||||
sprintf(scratchbuf, "error in actions for %s", node->n_name);
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
add_error(bnode, new_name(scratchbuf), LNULL, TRUE);
|
||||
}
|
||||
|
||||
if (! xflag)
|
||||
{
|
||||
if (code.w_termsig == 0)
|
||||
printf("*** Error code %d\n", code.w_retcode);
|
||||
else
|
||||
printf("*** Termination code %d\n", code.w_termsig);
|
||||
}
|
||||
|
||||
cake_error(node);
|
||||
goto endit;
|
||||
}
|
||||
|
||||
/* clean up after actions */
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
if (on_node(bnode, nf_NONVOL) && ! diff_novol(bnode))
|
||||
node_resetstat(bnode);
|
||||
or (rflag)
|
||||
node_setstat(bnode);
|
||||
else
|
||||
node_stat(bnode);
|
||||
}
|
||||
}
|
||||
|
||||
endit:
|
||||
|
||||
cdebug("update level %d finished\n", level);
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
if (oksofar)
|
||||
{
|
||||
if (on_node(bnode, nf_EXIST) || on_node(bnode, nf_PSEUDO) || nflag)
|
||||
bnode->n_kind = n_OK;
|
||||
else
|
||||
{
|
||||
set_node(bnode, nf_ERR);
|
||||
if (length(node->n_act) == 0)
|
||||
sprintf(scratchbuf, "no actions to make %s with", bnode->n_name);
|
||||
else
|
||||
sprintf(scratchbuf, "action did not create %s", bnode->n_name);
|
||||
|
||||
add_error(bnode, new_name(scratchbuf), LNULL, TRUE);
|
||||
trace_errs(bnode);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug)
|
||||
print_node(bnode);
|
||||
#endif
|
||||
}
|
||||
|
||||
put_trail("update", "finish");
|
||||
}
|
||||
|
||||
/*
|
||||
** Execute the plan prepared by chase.c
|
||||
** Prevent the deletion of the primary targets by cleanup.
|
||||
*/
|
||||
|
||||
execute(root)
|
||||
reg Node *root;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Node *target;
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug) { /* BRL */
|
||||
cdebug("execute plan:\n");
|
||||
print_node(root);
|
||||
}
|
||||
#endif
|
||||
for_list (ptr, root->n_old)
|
||||
{
|
||||
target = (Node *) ldata(ptr);
|
||||
set_node(target, nf_NODELETE);
|
||||
}
|
||||
|
||||
update(root, 0, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
** Carry out the specified actions and return the exit code.
|
||||
** Note that an empty list of actions is perfectly acceptable.
|
||||
*/
|
||||
|
||||
#define START_SCRIPT "{"
|
||||
#define FINISH_SCRIPT "}"
|
||||
|
||||
Wait
|
||||
carry_out(node, force_exec)
|
||||
reg Node *node;
|
||||
reg bool force_exec;
|
||||
{
|
||||
extern char *expand_cmds();
|
||||
extern Wait action();
|
||||
reg List *ptr;
|
||||
reg Act *act;
|
||||
reg Node *bnode;
|
||||
Wait code;
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug) { /* BRL */
|
||||
cdebug("carry_out plan:\n");
|
||||
print_node(node);
|
||||
}
|
||||
#endif
|
||||
if (Gflag && ! nflag)
|
||||
{
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
if (on_node(bnode, nf_EXIST))
|
||||
{
|
||||
cdebug("removing %s for -G\n", bnode->n_name);
|
||||
cake_remove(bnode->n_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for_list (ptr, node->n_act)
|
||||
{
|
||||
act = (Act *) ldata(ptr);
|
||||
|
||||
if (nflag)
|
||||
{
|
||||
if (off_act(act, af_MINUSN) && ! force_exec)
|
||||
show_act(act->a_str, (char *) NULL);
|
||||
else
|
||||
{
|
||||
reset_act(act, af_SILENT);
|
||||
printf("executing ...\n");
|
||||
code = action(act, node);
|
||||
printf("... done\n");
|
||||
if (code.w_status != 0)
|
||||
return code;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
code = action(act, node);
|
||||
if (code.w_status != 0)
|
||||
return code;
|
||||
}
|
||||
|
||||
code.w_status = 0;
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
** Execute the given command and return its status,
|
||||
** modified by flags and prefixes.
|
||||
*/
|
||||
|
||||
Wait
|
||||
action(act, node)
|
||||
reg Act *act;
|
||||
reg Node *node;
|
||||
{
|
||||
extern int cake_proc();
|
||||
extern Wait cake_wait();
|
||||
Wait code;
|
||||
reg A_kind type;
|
||||
reg int pid;
|
||||
reg char *after;
|
||||
|
||||
if( cakedebug ) { /* BRL */
|
||||
cdebug("action(): ", act->a_str, node);
|
||||
print_act(act);
|
||||
cdebug("\n");
|
||||
}
|
||||
if( act->a_str == NULL || strlen(act->a_str) <= 0 ) { /* BRL */
|
||||
printf("NOTE: Null action skipped\n");
|
||||
code.w_status = 0;
|
||||
return(code);
|
||||
}
|
||||
put_trail("action", "start");
|
||||
after = expand_cmds(act->a_str);
|
||||
if (! (on_act(act, af_SILENT) || sflag))
|
||||
show_act(act->a_str, after);
|
||||
act->a_str = after;
|
||||
|
||||
if (on_act(act, af_SCRIPT))
|
||||
type = Script;
|
||||
or (on_act(act, af_SYSTEM))
|
||||
type = System;
|
||||
else
|
||||
type = Exec;
|
||||
|
||||
pid = cake_proc(act->a_str, type, (char *) NULL, node, (int (*)()) NULL, (List *) NULL);
|
||||
code = cake_wait(pid);
|
||||
|
||||
if (on_act(act, af_IGNORE) || iflag)
|
||||
code.w_status = 0;
|
||||
|
||||
if (code.w_status != 0 && ! kflag)
|
||||
exit_cake(FALSE);
|
||||
|
||||
put_trail("action", "finish");
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
** Print an action in the format specified by the options.
|
||||
** The two args are the action before and after expansion.
|
||||
** The second may be NULL, in which case show_act does the
|
||||
** expansion itself.
|
||||
*/
|
||||
|
||||
show_act(before, after)
|
||||
reg char *before;
|
||||
reg char *after;
|
||||
{
|
||||
extern char *squeeze();
|
||||
reg char *form;
|
||||
|
||||
if (bflag)
|
||||
form = before;
|
||||
or (after != NULL)
|
||||
form = after;
|
||||
else
|
||||
form = expand_cmds(before);
|
||||
|
||||
if (wflag)
|
||||
printf("%s", form);
|
||||
else
|
||||
printf("%s", squeeze(form));
|
||||
}
|
||||
|
||||
/*
|
||||
** Reduce the width of the given command string
|
||||
** by squeezing out extra spaces and tabs.
|
||||
*/
|
||||
|
||||
char *
|
||||
squeeze(cmd)
|
||||
reg char *cmd;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg char *s;
|
||||
reg int i, oldi;
|
||||
reg bool inquotes;
|
||||
reg bool insingle;
|
||||
reg bool indouble;
|
||||
reg bool lastblank;
|
||||
|
||||
s = cmd;
|
||||
i = 0;
|
||||
lastblank = FALSE;
|
||||
while (*s != '\0')
|
||||
{
|
||||
while (*s != '\0' && (*s == ' ' || *s == '\t'))
|
||||
s++;
|
||||
|
||||
if (lastblank && (*s == '\n' || *s == '\r' || *s == '\f'))
|
||||
i--;
|
||||
|
||||
oldi = i;
|
||||
inquotes = FALSE;
|
||||
for (; *s != '\0' && ((*s != ' ' && *s != '\t') || inquotes); s++)
|
||||
{
|
||||
if (*s == '\\')
|
||||
{
|
||||
buf[i++] = *s;
|
||||
if (s[1] != '\0')
|
||||
buf[i++] = *++s;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*s == '"' && ! (inquotes && insingle))
|
||||
{
|
||||
inquotes = ! inquotes;
|
||||
indouble = TRUE;
|
||||
insingle = FALSE;
|
||||
}
|
||||
or (*s == '\'' && ! (inquotes && indouble))
|
||||
{
|
||||
inquotes = ! inquotes;
|
||||
insingle = TRUE;
|
||||
indouble = FALSE;
|
||||
}
|
||||
|
||||
buf[i++] = *s;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == oldi || buf[i-1] == '\n' || buf[i-1] == '\r' || buf[i-1] == '\f')
|
||||
lastblank = FALSE;
|
||||
else
|
||||
{
|
||||
lastblank = TRUE;
|
||||
buf[i++] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
buf[i] = '\0';
|
||||
if (i >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: command '%s' too long\n", buf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
while (buf[i-1] == ' ' || buf[i-1] == '\t')
|
||||
buf[--i] = '\0';
|
||||
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
** Clean up after an error or interrupt.
|
||||
*/
|
||||
|
||||
cake_error(node)
|
||||
reg Node *node;
|
||||
{
|
||||
reg List *ptr, *ptr1;
|
||||
reg Node *bnode, *onode;
|
||||
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
for_list (ptr1, bnode->n_old)
|
||||
{
|
||||
onode = (Node *) ldata(ptr1);
|
||||
set_node(onode, nf_NODELETE);
|
||||
}
|
||||
|
||||
if (on_node(bnode, nf_EXIST) && off_node(bnode, nf_PRECIOUS))
|
||||
cake_remove(bnode->n_name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Clean up after all the fuss.
|
||||
*/
|
||||
|
||||
cleanup()
|
||||
{
|
||||
extern List *get_allnodes();
|
||||
reg List *ptr, *ptr1;
|
||||
reg List *nodes;
|
||||
reg Node *node, *onode;
|
||||
|
||||
cdebug("cleanup:\n");
|
||||
|
||||
if (nflag)
|
||||
return;
|
||||
|
||||
nodes = get_allnodes();
|
||||
for_list (ptr, nodes)
|
||||
{
|
||||
node = (Node *) ldata(ptr);
|
||||
cdebug("considering %s: ", node->n_name);
|
||||
|
||||
if (off_node(node, nf_EXIST))
|
||||
{
|
||||
cdebug("nonexistent\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (on_node(node, nf_ERR) || is_noway(node))
|
||||
{
|
||||
cdebug("errors or noway\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! dflag && off_node(node, nf_REDUNDANT))
|
||||
{
|
||||
cdebug("no flag\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* file exists and OK, shall we delete it ? */
|
||||
|
||||
/* not if we thought earlier it need it */
|
||||
if (on_node(node, nf_NODELETE))
|
||||
{
|
||||
cdebug("nodelete flag\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* not if it cannot be regenerated at all */
|
||||
if (length(node->n_act) == 0)
|
||||
{
|
||||
cdebug("nonregenerable\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* not if it cannot be regenerated as is */
|
||||
if ((node->n_utime < node->n_rtime) && off_node(node, nf_NEWFILE))
|
||||
{
|
||||
cdebug("nonregenerable as is\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* or if its ancestors are not all OK */
|
||||
for_list (ptr1, node->n_old)
|
||||
{
|
||||
onode = (Node *) ldata(ptr1);
|
||||
if (! is_ok(onode))
|
||||
{
|
||||
cdebug("ancestor not ok\n");
|
||||
goto nextnode;
|
||||
}
|
||||
}
|
||||
|
||||
cdebug("DELETED\n");
|
||||
cake_remove(node->n_name);
|
||||
|
||||
nextnode: ;
|
||||
}
|
||||
}
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
** Cake definitions.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include "std.h"
|
||||
#include "conf.h"
|
||||
#include "wait.h"
|
||||
#include "list.h"
|
||||
#include "table.h"
|
||||
|
||||
#define nf_NONVOL 0x0001
|
||||
#define nf_PRECIOUS 0x0002
|
||||
#define nf_PSEUDO 0x0004
|
||||
#define nf_REDUNDANT 0x0008
|
||||
#define nf_WHEN 0x0010
|
||||
#define nf_DEPNONVOL 0x0020
|
||||
#define nf_NODELETE 0x0040
|
||||
#define nf_NEWFILE 0x0080
|
||||
#define nf_EXIST 0x0100
|
||||
#define nf_BUSY 0x0200
|
||||
#define nf_ERR 0x0400
|
||||
#define nf_TRACED 0x0800
|
||||
#define nf_WARNED 0x1000
|
||||
#define nf_ORIG 0x2000
|
||||
|
||||
#define af_SILENT 0x0001
|
||||
#define af_IGNORE 0x0002
|
||||
#define af_MINUSN 0x0004
|
||||
#define af_SYSTEM 0x0008
|
||||
#define af_SCRIPT 0x0010
|
||||
|
||||
/* type of internal patterns */
|
||||
typedef struct s_pat
|
||||
{
|
||||
char *p_str;
|
||||
short p_flag;
|
||||
short p_cmd;
|
||||
} Pat;
|
||||
|
||||
/* type of internal actions */
|
||||
typedef struct s_act
|
||||
{
|
||||
char *a_str;
|
||||
short a_flag;
|
||||
} Act;
|
||||
|
||||
/* kinds of actions */
|
||||
typedef enum
|
||||
{
|
||||
Exec, System, Script
|
||||
} A_kind;
|
||||
|
||||
/* kinds of tests */
|
||||
typedef enum
|
||||
{
|
||||
t_TRUE, t_FALSE, t_AND, t_OR, t_NOT,
|
||||
t_CMD, t_MATCH, t_LIST, t_EXIST, t_CANDO, t_OK
|
||||
} T_kind;
|
||||
|
||||
/* type of tests */
|
||||
typedef struct s_test
|
||||
{
|
||||
T_kind t_kind;
|
||||
Pat *t_pat;
|
||||
List *t_list; /* of Pat(L), char(M) */
|
||||
char *t_cmd;
|
||||
struct s_test *t_left;
|
||||
struct s_test *t_right;
|
||||
} Test;
|
||||
|
||||
/* type of substitution variables */
|
||||
typedef struct s_var
|
||||
{
|
||||
char *v_val;
|
||||
bool v_bound;
|
||||
} Var;
|
||||
|
||||
#define NOVAR 10
|
||||
#define MAXVAR 11
|
||||
|
||||
/* type of substitution environments */
|
||||
typedef Var Env[MAXVAR];
|
||||
|
||||
/* type of entries */
|
||||
typedef struct s_entry
|
||||
{
|
||||
char *e_file;
|
||||
List *e_new; /* of Pat */
|
||||
List *e_old; /* of Pat */
|
||||
List *e_when; /* of Pat */
|
||||
List *e_act; /* of Act */
|
||||
Test *e_cond;
|
||||
bool e_dblc;
|
||||
} Entry;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
n_OK, n_CANDO, n_NOWAY
|
||||
} N_kind;
|
||||
|
||||
/* type of nodes in the dependency graph */
|
||||
typedef struct s_node
|
||||
{
|
||||
char *n_name; /* name of the node */
|
||||
N_kind n_kind; /* current status of the chase */
|
||||
int n_flag; /* the applicable nf_[A-Z]* */
|
||||
time_t n_rtime; /* Real modify time if exist */
|
||||
time_t n_stime; /* Saved copy of n_rtime */
|
||||
time_t n_utime; /* last ancestor Update time */
|
||||
List *n_new; /* left side or rule, of Node */
|
||||
List *n_old; /* right side of rule, of Node */
|
||||
List *n_when; /* starred right side, of Pat */
|
||||
List *n_act; /* the actions, of Act */
|
||||
#if 0 /* N must be 1 for the time being */
|
||||
int n_pid; /* current update process */
|
||||
char *n_file; /* name of output file */
|
||||
#endif
|
||||
char *n_msg; /* error message, if nf_ERR */
|
||||
List *n_badguys; /* error causes, if nf_ERR */
|
||||
} Node;
|
||||
|
||||
typedef struct s_proc
|
||||
{
|
||||
int pr_pid;
|
||||
bool pr_run;
|
||||
Wait pr_stat;
|
||||
int (*pr_func)();
|
||||
List *pr_args;
|
||||
Node *pr_node;
|
||||
} Proc;
|
||||
|
||||
#include "extern.h"
|
||||
#include "macro.h"
|
||||
-202
@@ -1,202 +0,0 @@
|
||||
%{
|
||||
/*
|
||||
** Grammar for Cakefiles
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <ctype.h>
|
||||
|
||||
extern List *set_flag();
|
||||
extern int yylineno;
|
||||
extern char *yyfile;
|
||||
%}
|
||||
|
||||
%start file
|
||||
|
||||
%union
|
||||
{
|
||||
int Uint;
|
||||
char *Ustr;
|
||||
List *Ulist;
|
||||
Entry *Uent;
|
||||
Test *Utest;
|
||||
Act *Uact;
|
||||
Pat *Upat;
|
||||
}
|
||||
|
||||
%token NL EMPTYLINE
|
||||
%token NONVOL PRECIOUS REDUNDANT PSEUDO WHEN
|
||||
%token IF IN MATCH EXIST CANDO OK
|
||||
%token LPAREN RPAREN
|
||||
%token <Ustr> COLON PAT PATCMD TESTCMD
|
||||
%token <Uact> BEGIN_ACT ACT END_ACT
|
||||
%token GARBAGE
|
||||
%left OR
|
||||
%left AND
|
||||
%left NOT
|
||||
|
||||
%type <Uent> rule
|
||||
%type <Utest> cond test
|
||||
%type <Upat> basepat
|
||||
%type <Uact> act
|
||||
%type <Uint> flag flag_el
|
||||
%type <Ulist> pat
|
||||
%type <Ulist> rule_l ACT_el act_el pat_el pat_l
|
||||
|
||||
%%
|
||||
|
||||
/**********************************************************************/
|
||||
/* Entries */
|
||||
|
||||
file : empty_el ent_esl empty_el
|
||||
;
|
||||
|
||||
entry : rule_l act_el
|
||||
{ new_entry($1, $2); }
|
||||
;
|
||||
|
||||
rule : pat_l COLON pat_el cond NL
|
||||
{ $$ = make_dep($1, $3, $4, new_name(yyfile), $2); }
|
||||
;
|
||||
|
||||
cond : IF test
|
||||
{ $$ = $2; }
|
||||
| /* empty */
|
||||
{ $$ = (Test *) NULL; }
|
||||
;
|
||||
|
||||
test : basepat IN pat_l
|
||||
{ $$ = make_test_l($1, $3); }
|
||||
| basepat MATCH basepat
|
||||
{ $$ = make_test_m($1, (Pat *) NULL, $3);}
|
||||
| basepat MATCH basepat basepat
|
||||
{ $$ = make_test_m($1, $3, $4); }
|
||||
| EXIST basepat
|
||||
{ $$ = make_test_s(t_EXIST, $2); }
|
||||
| CANDO basepat
|
||||
{ $$ = make_test_s(t_CANDO, $2); }
|
||||
| OK basepat
|
||||
{ $$ = make_test_s(t_OK, $2); }
|
||||
| TESTCMD
|
||||
{ $$ = make_test_c($1); }
|
||||
| test AND test
|
||||
{ $$ = make_test_b(t_AND, $1, $3);}
|
||||
| test OR test
|
||||
{ $$ = make_test_b(t_OR, $1, $3); }
|
||||
| NOT test
|
||||
{ $$ = make_test_u(t_NOT, $2); }
|
||||
| LPAREN test RPAREN
|
||||
{ $$ = $2; }
|
||||
;
|
||||
|
||||
act : ACT
|
||||
{ $$ = $1; }
|
||||
| BEGIN_ACT ACT_el END_ACT
|
||||
{ $$ = prep_script($1, $2, $3); }
|
||||
;
|
||||
|
||||
basepat : PAT
|
||||
{ $$ = make_pat($1, FALSE, 0); }
|
||||
| PATCMD
|
||||
{ $$ = make_pat($1, TRUE, 0); }
|
||||
;
|
||||
|
||||
pat : basepat flag_el
|
||||
{ $$ = set_flag(makelist($1), $2);}
|
||||
| LPAREN pat_l RPAREN flag_el
|
||||
{ $$ = set_flag($2, $4); }
|
||||
;
|
||||
|
||||
flag : NONVOL
|
||||
{ $$ = nf_NONVOL; }
|
||||
| PRECIOUS
|
||||
{ $$ = nf_PRECIOUS; }
|
||||
| REDUNDANT
|
||||
{ $$ = nf_REDUNDANT; }
|
||||
| PSEUDO
|
||||
{ $$ = nf_PSEUDO; }
|
||||
| WHEN
|
||||
{ $$ = nf_WHEN; }
|
||||
;
|
||||
|
||||
/* From here on, the grammar is JUNK */
|
||||
/**********************************************************************/
|
||||
/* Lists */
|
||||
|
||||
ent_esl : entry
|
||||
| ent_esl empty_l entry
|
||||
;
|
||||
|
||||
rule_l : rule
|
||||
{ $$ = makelist($1); }
|
||||
| rule_l rule
|
||||
{ $$ = addtail($1, $2); }
|
||||
;
|
||||
|
||||
ACT_el : /* empty */
|
||||
{ $$ = makelist0(); }
|
||||
| ACT_el ACT
|
||||
{ $$ = addtail($1, $2); }
|
||||
;
|
||||
|
||||
act_el : /* empty */
|
||||
{ $$ = makelist0(); }
|
||||
| act_el act
|
||||
{ $$ = addtail($1, $2); }
|
||||
;
|
||||
|
||||
pat_el : /* empty */
|
||||
{ $$ = makelist0(); }
|
||||
| pat_l
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
pat_l : pat
|
||||
{ $$ = $1; }
|
||||
| pat_l pat
|
||||
{ $$ = addlist($1, $2); }
|
||||
;
|
||||
|
||||
flag_el : /* empty */
|
||||
{ $$ = 0; }
|
||||
| flag_el flag
|
||||
{ $$ = $1 | $2; }
|
||||
;
|
||||
|
||||
empty_el: /* empty */
|
||||
| empty_l
|
||||
;
|
||||
|
||||
empty_l : EMPTYLINE
|
||||
| empty_l EMPTYLINE
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
yyerror(s)
|
||||
char *s;
|
||||
{
|
||||
extern int yyleng;
|
||||
extern char yytext[];
|
||||
char buf[80];
|
||||
|
||||
if (yychar <= 0)
|
||||
{
|
||||
sprintf(buf, "premature EOF");
|
||||
yylineno--;
|
||||
}
|
||||
or (yytext[0] == '\n' || yytext[0] == '\f')
|
||||
sprintf(buf, "%s at end of line", s);
|
||||
or (isprint(yytext[0]))
|
||||
sprintf(buf, "%s at symbol %s", s, yytext);
|
||||
else
|
||||
sprintf(buf, "%s at \\%o", s, yytext[0]);
|
||||
|
||||
if (cakedebug)
|
||||
printf("%s, %d: %s, token %d\n", yyfile, yylineno, buf, yychar);
|
||||
else
|
||||
printf("%s, %d: %s\n", yyfile, yylineno, buf);
|
||||
}
|
||||
-371
@@ -1,371 +0,0 @@
|
||||
%{
|
||||
/*
|
||||
** Scanner for Cake
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include "cake_g.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
#define ret(x) if (lexdebug) printf("lex: x\n"); return x
|
||||
#else
|
||||
#define ret(x) return x
|
||||
#endif
|
||||
|
||||
/* YYLMAX must be defined here; it can't be defined in conf.h */
|
||||
#undef YYLMAX
|
||||
#define YYLMAX MAXLEXBUF
|
||||
|
||||
#define LATE_CATCH
|
||||
#define LATE_RECOVERY printf("cake: token '%s' is too long\n", yytext); \
|
||||
exit(1);
|
||||
|
||||
#define LBRACE '{'
|
||||
#define RBRACE '}'
|
||||
|
||||
extern char *yysquare();
|
||||
extern char *yycurly();
|
||||
|
||||
extern int lexdebug;
|
||||
char *yyfile = "no input file";
|
||||
bool afterifdef = FALSE;
|
||||
%}
|
||||
|
||||
%a 2500
|
||||
%o 5000
|
||||
|
||||
%start edge middle
|
||||
|
||||
pat [a-zA-Z_0-9/%+-.,]
|
||||
sp [ \t]
|
||||
nl [\n\f]
|
||||
nonl [^\n\f]
|
||||
enonl ({nonl}|\\{nl})
|
||||
|
||||
%%
|
||||
|
||||
"if" { BEGIN middle; ret(IF); }
|
||||
"and" { BEGIN middle; ret(AND); }
|
||||
"or" { BEGIN middle; ret(OR); }
|
||||
"not" { BEGIN middle; ret(NOT); }
|
||||
"in" { BEGIN middle; ret(IN); }
|
||||
"match" { BEGIN middle; ret(MATCH); }
|
||||
"exist" { BEGIN middle; ret(EXIST); }
|
||||
"cando" { BEGIN middle; ret(CANDO); }
|
||||
"ok" { BEGIN middle; ret(OK); }
|
||||
|
||||
"(" { BEGIN middle; ret(LPAREN); }
|
||||
")" { BEGIN middle; ret(RPAREN); }
|
||||
|
||||
"@" { BEGIN middle; ret(NONVOL); }
|
||||
"!" { BEGIN middle; ret(PRECIOUS); }
|
||||
"&" { BEGIN middle; ret(PSEUDO); }
|
||||
"^" { BEGIN middle; ret(REDUNDANT); }
|
||||
"*" { BEGIN middle; ret(WHEN); }
|
||||
|
||||
":" |
|
||||
"::" {
|
||||
BEGIN middle;
|
||||
yylval.Ustr = new_name(yytext);
|
||||
ret(COLON);
|
||||
}
|
||||
|
||||
({pat}|\\{nonl})+ {
|
||||
BEGIN middle;
|
||||
yylval.Ustr = new_name(yytext);
|
||||
ret(PAT);
|
||||
}
|
||||
|
||||
\"([^"]|\\\")*\" {
|
||||
BEGIN middle;
|
||||
/* strip off quotes */
|
||||
yytext[yyleng-1] = '\0';
|
||||
yylval.Ustr = new_name(yytext+1);
|
||||
ret(PAT);
|
||||
}
|
||||
|
||||
"[[" {
|
||||
BEGIN middle;
|
||||
yylval.Ustr = yysquare();
|
||||
ret(PATCMD);
|
||||
}
|
||||
|
||||
"{{" {
|
||||
BEGIN middle;
|
||||
yylval.Ustr = yycurly();
|
||||
ret(TESTCMD);
|
||||
}
|
||||
|
||||
<middle>({sp}|\\{nl})* { BEGIN middle; }
|
||||
|
||||
<edge>[@!+-]*"{"{enonl}*{nl} |
|
||||
<edge>[@!+-]*"}"{enonl}*{nl} |
|
||||
<edge>{sp}+{enonl}+{nl} {
|
||||
BEGIN edge;
|
||||
afterifdef = FALSE;
|
||||
yylval.Uact = prep_act(yytext);
|
||||
|
||||
/* comment out check_actlen if */
|
||||
/* have a lex driver with CATCH */
|
||||
check_actlen();
|
||||
|
||||
/* braces around ret ARE needed */
|
||||
/* as ret expands to an if stmt */
|
||||
if (yylval.Uact->a_str[0] == LBRACE)
|
||||
{
|
||||
ret(BEGIN_ACT);
|
||||
}
|
||||
or (yylval.Uact->a_str[0] == RBRACE)
|
||||
{
|
||||
ret(END_ACT);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret(ACT);
|
||||
}
|
||||
}
|
||||
|
||||
<edge>"set"{nonl}*{nl} {
|
||||
BEGIN edge;
|
||||
if (lexdebug)
|
||||
printf("set line\n");
|
||||
yyset(yytext);
|
||||
}
|
||||
|
||||
<edge>#{nonl}*{nl} {
|
||||
BEGIN edge;
|
||||
if (lexdebug)
|
||||
printf("hash line\n");
|
||||
yyhash(yytext);
|
||||
if (! afterifdef)
|
||||
ret(EMPTYLINE);
|
||||
}
|
||||
|
||||
<edge>{sp}*{nl} {
|
||||
BEGIN edge;
|
||||
if (lexdebug)
|
||||
printf("empty line\n");
|
||||
if (! afterifdef)
|
||||
ret(EMPTYLINE);
|
||||
}
|
||||
|
||||
<middle>{nl} {
|
||||
BEGIN edge;
|
||||
afterifdef = FALSE;
|
||||
ret(NL);
|
||||
}
|
||||
|
||||
{nonl} { BEGIN middle; ret(GARBAGE); }
|
||||
|
||||
"$"{nonl}*{nl} { BEGIN edge; }
|
||||
|
||||
%%
|
||||
|
||||
yyinit()
|
||||
{
|
||||
BEGIN edge;
|
||||
}
|
||||
|
||||
yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
yyset(text)
|
||||
reg char text[];
|
||||
{
|
||||
reg char *s;
|
||||
int setc;
|
||||
char *setv[MAXARGS];
|
||||
|
||||
for (s = text+4; *s != '\0' && isspace(*s); s++)
|
||||
;
|
||||
|
||||
setc = parse_args(s, setv);
|
||||
process_args(setv, &setc, 0);
|
||||
if (setc > 0)
|
||||
printf("cake: non-options on parameter line ignored\n");
|
||||
}
|
||||
|
||||
yyhash(text)
|
||||
reg char text[];
|
||||
{
|
||||
reg char *oldfile = yyfile;
|
||||
reg char *s, *t;
|
||||
|
||||
afterifdef = TRUE; /* assume so until proven otherwise */
|
||||
if (sscanf(text+1, "%d", &yylineno) != 1)
|
||||
return;
|
||||
|
||||
text[strlen(text)-1] = '\0'; /* clobber the newline */
|
||||
for (s = text; *s != '\0' && *s != '"' && !isalpha(*s); s++)
|
||||
;
|
||||
|
||||
if (*s == '\0')
|
||||
return;
|
||||
|
||||
if (*s != '"')
|
||||
yyfile = new_name(s);
|
||||
else
|
||||
{
|
||||
for (t = s+strlen(s)-1; t != s && *t != '"'; t--)
|
||||
;
|
||||
|
||||
if (t != s)
|
||||
*t = '\0';
|
||||
|
||||
yyfile = new_name(s+1);
|
||||
}
|
||||
|
||||
if (yyfile != oldfile)
|
||||
{
|
||||
afterifdef = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Read in a PATCMD, which is [[.*PATCMD?.*]]
|
||||
** (or a matched set of double brackets with other stuff.
|
||||
** Note that PATCMD cannot be described by a REAL regular
|
||||
** expression; the one above cheats by using recursion.
|
||||
** yysquare returns the PATCMD brackets and all.
|
||||
*/
|
||||
|
||||
char *
|
||||
yysquare()
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg int c, c1;
|
||||
reg int i;
|
||||
reg int n; /* number of outstanding levels */
|
||||
|
||||
n = 1;
|
||||
i = 0;
|
||||
buf[i++] = '[';
|
||||
buf[i++] = '[';
|
||||
for (c = input(); c != '\0' && c != '\n' && c != '\f'; c = input())
|
||||
{
|
||||
buf[i++] = c;
|
||||
if (c == ']')
|
||||
{
|
||||
if ((c1 = input()) != ']')
|
||||
{
|
||||
/* for the next iteration */
|
||||
unput(c1);
|
||||
continue;
|
||||
}
|
||||
|
||||
buf[i++] = c1;
|
||||
if (--n > 0)
|
||||
continue;
|
||||
|
||||
buf[i] = '\0';
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: buffer overflow in yysquare\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
if (lexdebug)
|
||||
printf("yysquare: %s\n", buf);
|
||||
|
||||
fflush(stdout);
|
||||
return new_name(buf);
|
||||
}
|
||||
or (c == '[')
|
||||
{
|
||||
if ((c1 = input()) != '[')
|
||||
{
|
||||
/* for the next iteration */
|
||||
unput(c1);
|
||||
continue;
|
||||
}
|
||||
|
||||
buf[i++] = c1;
|
||||
n++;
|
||||
}
|
||||
or (c == '\\')
|
||||
{
|
||||
/* don't check next char */
|
||||
if ((c1 = input()) != '\0')
|
||||
buf[i++] = c1;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '\0')
|
||||
fprintf(stderr, "%s, %d: premature EOF\n", yyfile, yylineno);
|
||||
else
|
||||
fprintf(stderr, "%s, %d: unescaped newline inside a command\n", yyfile, yylineno);
|
||||
|
||||
exit_cake(FALSE);
|
||||
return("--error--"); /* BRL */
|
||||
}
|
||||
|
||||
/*
|
||||
** Read in a TESTCMD, which is {{.*}}. Strip the brackets.
|
||||
*/
|
||||
|
||||
char *
|
||||
yycurly()
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg int c, c1;
|
||||
reg int i;
|
||||
|
||||
i = 0;
|
||||
for (c = input(); c != '\0' && c != '\n' && c != '\f'; c = input())
|
||||
{
|
||||
buf[i++] = c;
|
||||
if (c == RBRACE)
|
||||
{
|
||||
if ((c1 = input()) != RBRACE)
|
||||
{
|
||||
/* for the next iteration */
|
||||
unput(c1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* overwrite first RBRACE */
|
||||
buf[--i] = '\0';
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: buffer overflow in yycurly\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
if (lexdebug)
|
||||
printf("yycurly: %s\n", buf);
|
||||
|
||||
fflush(stdout);
|
||||
return new_name(buf);
|
||||
}
|
||||
or (c == '\\')
|
||||
{
|
||||
/* don't check next char */
|
||||
if ((c1 = input()) != '\0')
|
||||
buf[i++] = c1;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '\0')
|
||||
fprintf(stderr, "%s, %d: premature EOF\n", yyfile, yylineno);
|
||||
else
|
||||
fprintf(stderr, "%s, %d: unescaped newline inside a command\n", yyfile, yylineno);
|
||||
|
||||
exit_cake(FALSE);
|
||||
return("--error--"); /* BRL */
|
||||
}
|
||||
|
||||
check_actlen()
|
||||
{
|
||||
if (strlen(yytext) >= YYLMAX)
|
||||
{
|
||||
printf("cake: action '%s' too long\n", yytext);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
}
|
||||
-579
@@ -1,579 +0,0 @@
|
||||
/*
|
||||
** Module to chase Cake dependencies.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** The main chasing function. It checks all entries to see
|
||||
** if they describe a dependency of the name. If the second arg
|
||||
** is not NULL, it is taken as a fixed choice (by another do_chase)
|
||||
** as to which entry will actually be used to generate the name.
|
||||
**
|
||||
** The kinds of nodes returned by do_chase are as follows.
|
||||
** OK means that no action is needed to update the name.
|
||||
** CANDO means that the action is known and there is no reason
|
||||
** why it shouldn't succeed. NOWAY is set when neither of those
|
||||
** conditions is satisfied. nf_ERR means that some error has
|
||||
** occurred; nf_ERR nodes are never touched again; except for
|
||||
** printing the error messages themselves. (NOWAY nodes *are*
|
||||
** touched by act.c to update as many ancestors as possible.)
|
||||
**
|
||||
** Whenever nf_ERR is not set, do_chase sets the utime field,
|
||||
** and the rtime field as well if the file exists.
|
||||
*/
|
||||
|
||||
do_chase(node, picked)
|
||||
reg Node *node;
|
||||
reg Entry *picked;
|
||||
{
|
||||
extern get_utime();
|
||||
extern time_t cake_gettime();
|
||||
extern Node *chase();
|
||||
extern Node *chase_node();
|
||||
extern time_t pick_time();
|
||||
extern bool match();
|
||||
extern bool eval();
|
||||
extern Entry *ground_entry();
|
||||
extern Test *deref_test();
|
||||
extern deref_entry();
|
||||
extern List *entries;
|
||||
extern char *list_names();
|
||||
Env env;
|
||||
reg List *ptr, *ptr1, *ptr2;
|
||||
reg Node *newnode, *onode;
|
||||
reg Entry *entry, *newentry;
|
||||
reg Pat *pat;
|
||||
reg List *entry_anay, *entry_ayea; /* of Entry */
|
||||
reg List *miss_anay, *miss_ayea; /* of Node */
|
||||
reg List *pot_entry; /* of Entry */
|
||||
reg List *pot_pat; /* of Pat */
|
||||
reg List *probe_old; /* of Node */
|
||||
reg bool found, missing;
|
||||
reg bool singleton, orphan;
|
||||
|
||||
put_trail("do_chase", "start");
|
||||
cdebug("chasing %s\n", node->n_name);
|
||||
|
||||
if (off_node(node, nf_EXIST))
|
||||
set_node(node, nf_NEWFILE);
|
||||
|
||||
/* find all entries which could generate this name */
|
||||
pot_entry = makelist0();
|
||||
pot_pat = makelist0();
|
||||
for_list (ptr, entries)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr);
|
||||
/* try everything on the left side of the entry */
|
||||
for_list (ptr1, entry->e_new)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
if (match(env, node->n_name, pat))
|
||||
{
|
||||
if ((newentry = ground_entry(env, entry)) == (Entry *) NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cannot perform substitutions on entry for %s",
|
||||
node->n_name);
|
||||
add_error(node, new_name(scratchbuf), LNULL, TRUE);
|
||||
goto end;
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (entrydebug)
|
||||
{
|
||||
printf("Applicable entry\n");
|
||||
print_entry(newentry);
|
||||
}
|
||||
#endif
|
||||
|
||||
addtail(pot_entry, newentry); /* na */
|
||||
addtail(pot_pat, pat); /* na */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cdebug("%s: %d potentials\n", node->n_name, length(pot_entry));
|
||||
|
||||
/* find out which tests are satisfied */
|
||||
entry_anay = makelist0();
|
||||
entry_ayea = makelist0();
|
||||
for_2list (ptr1, ptr2, pot_entry, pot_pat)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr1);
|
||||
pat = (Pat *) ldata(ptr2);
|
||||
|
||||
for_list (ptr, entry->e_when)
|
||||
{
|
||||
reg Node *whennode;
|
||||
reg Pat *whenpat;
|
||||
|
||||
whenpat = (Pat *) ldata(ptr);
|
||||
whennode = chase(whenpat->p_str, whenpat->p_flag, (Entry *) NULL);
|
||||
if (off_node(whennode, nf_ERR))
|
||||
{
|
||||
if (is_ok(whennode))
|
||||
continue;
|
||||
|
||||
if (nflag && off_node(whennode, nf_WARNED))
|
||||
{
|
||||
printf("cake -n: warning, need to make %s to find dependencies\n",
|
||||
whenpat->p_str);
|
||||
set_node(whennode, nf_WARNED);
|
||||
}
|
||||
|
||||
update(whennode, 100, TRUE);
|
||||
}
|
||||
|
||||
if (on_node(whennode, nf_ERR) || ! is_ok(whennode))
|
||||
{
|
||||
sprintf(scratchbuf, "cannot find out if entry applies to %s",
|
||||
node->n_name);
|
||||
add_error(node, new_name(scratchbuf), makelist(whennode), TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (entrydebug)
|
||||
{
|
||||
printf("about to test condition\n");
|
||||
print_entry(entry);
|
||||
}
|
||||
#endif
|
||||
|
||||
entry->e_cond = deref_test(entry->e_cond);
|
||||
if (! eval(node, entry->e_cond, env))
|
||||
{
|
||||
cdebug("condition FALSE\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* here we know that this entry applies */
|
||||
deref_entry(env, entry);
|
||||
|
||||
if (Lflag)
|
||||
{
|
||||
for_list (ptr, entry->e_old)
|
||||
{
|
||||
reg Pat *opat;
|
||||
|
||||
opat = (Pat *) ldata(ptr);
|
||||
if (streq(node->n_name, opat->p_str))
|
||||
{
|
||||
cdebug("found loop in entry at %s\n", node->n_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node->n_flag |= pat->p_flag;
|
||||
if (length(entry->e_act) == 0)
|
||||
addtail(entry_anay, entry); /* no assigment */
|
||||
else
|
||||
addtail(entry_ayea, entry); /* no assigment */
|
||||
}
|
||||
|
||||
if (on_node(node, nf_ERR))
|
||||
return;
|
||||
|
||||
cdebug("%s: no action: %d, with actions: %d\n",
|
||||
node->n_name, length(entry_anay), length(entry_ayea));
|
||||
|
||||
/* All entries considered from now on are ground */
|
||||
|
||||
/* see if the file is an original */
|
||||
if (length(entry_anay) == 0 && length(entry_ayea) == 0)
|
||||
{
|
||||
if (off_node(node, nf_EXIST))
|
||||
{
|
||||
cdebug("%s: noway\n", node->n_name);
|
||||
node->n_kind = n_NOWAY;
|
||||
node->n_utime = GENESIS;
|
||||
sprintf(scratchbuf, "base file %s does not exist", node->n_name);
|
||||
add_error(node, new_name(scratchbuf), LNULL, FALSE);
|
||||
goto end;
|
||||
}
|
||||
|
||||
set_node(node, nf_ORIG);
|
||||
cdebug("%s: orig ok\n", node->n_name);
|
||||
node->n_kind = n_OK;
|
||||
node->n_utime = node->n_rtime;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* see to actionless dependencies */
|
||||
missing = FALSE;
|
||||
miss_anay = NULL;
|
||||
for_list (ptr, entry_anay)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr);
|
||||
for_list (ptr1, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
newnode = chase(pat->p_str, pat->p_flag, (Entry *) NULL);
|
||||
if (on_node(newnode, nf_ERR) || is_noway(newnode))
|
||||
{
|
||||
missing = TRUE;
|
||||
miss_anay = addtail(miss_anay, newnode);
|
||||
}
|
||||
|
||||
addtail(node->n_old, newnode); /* na */
|
||||
}
|
||||
}
|
||||
|
||||
cdebug("%s: unconditional dependencies, %s\n",
|
||||
node->n_name, missing? "some missing": "all there");
|
||||
|
||||
/*
|
||||
** If necessary, choose a feasible action dependency.
|
||||
** However, if there is only one, select it even if
|
||||
** it is not feasible.
|
||||
*/
|
||||
|
||||
found = FALSE;
|
||||
miss_ayea = NULL;
|
||||
if (picked == (Entry *) NULL)
|
||||
{
|
||||
singleton = (length(entry_ayea) == 1);
|
||||
orphan = (length(entry_ayea) == 0);
|
||||
|
||||
for_list (ptr, entry_ayea)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr);
|
||||
/* first copy of this code, with chase */
|
||||
found = TRUE; /* assume it for the moment */
|
||||
probe_old = makelist0();
|
||||
for_list (ptr1, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
newnode = chase(pat->p_str, pat->p_flag, (Entry *) NULL);
|
||||
if (on_node(newnode, nf_ERR) || is_noway(newnode))
|
||||
{
|
||||
found = FALSE;
|
||||
miss_ayea = addtail(miss_ayea, newnode);
|
||||
if (! singleton)
|
||||
break;
|
||||
}
|
||||
|
||||
addtail(probe_old, newnode); /* na */
|
||||
}
|
||||
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
singleton = TRUE;
|
||||
orphan = FALSE;
|
||||
|
||||
cdebug("%s: was given generator\n", node->n_name);
|
||||
entry = picked;
|
||||
|
||||
/* second copy of this code, with chase_node */
|
||||
found = TRUE; /* assume it for the moment */
|
||||
probe_old = makelist0();
|
||||
for_list (ptr1, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
newnode = chase_node(pat->p_str);
|
||||
if (on_node(newnode, nf_ERR) || is_noway(newnode))
|
||||
{
|
||||
found = FALSE;
|
||||
miss_ayea = addtail(miss_ayea, newnode);
|
||||
if (! singleton)
|
||||
break;
|
||||
}
|
||||
|
||||
addtail(probe_old, newnode); /* na */
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
/* we have found an applicable entry */
|
||||
cdebug("%s: found feasible generator\n", node->n_name);
|
||||
addlist(node->n_old, probe_old); /* na */
|
||||
node->n_act = entry->e_act;
|
||||
if (picked == (Entry *) NULL)
|
||||
set_buddies(node, entry);
|
||||
picked = entry;
|
||||
}
|
||||
or (singleton)
|
||||
{
|
||||
/* we have only one (inapplicable) entry */
|
||||
/* so we shall make do as best we can */
|
||||
cdebug("%s: found single infeasible generator\n", node->n_name);
|
||||
addlist(node->n_old, probe_old); /* na */
|
||||
node->n_act = entry->e_act;
|
||||
if (picked == (Entry *) NULL)
|
||||
set_buddies(node, entry);
|
||||
picked = entry;
|
||||
}
|
||||
or (orphan && on_node(node, nf_PSEUDO))
|
||||
{
|
||||
/* no entry is needed, act as we had one */
|
||||
found = TRUE;
|
||||
cdebug("%s: no generator, no problem\n", node->n_name);
|
||||
node->n_act = makelist0();
|
||||
}
|
||||
else
|
||||
{
|
||||
cdebug("%s: no feasible generator\n", node->n_name);
|
||||
node->n_act = makelist0();
|
||||
}
|
||||
|
||||
if (length(node->n_act) > 0 && length(picked->e_old) == 0)
|
||||
node->n_utime = cake_gettime();
|
||||
else
|
||||
get_utime(node, TRUE);
|
||||
|
||||
for_list (ptr, node->n_old)
|
||||
{
|
||||
newnode = (Node *) ldata(ptr);
|
||||
if (on_node(newnode, nf_NONVOL))
|
||||
set_node(node, nf_DEPNONVOL);
|
||||
}
|
||||
|
||||
if (missing)
|
||||
{
|
||||
node->n_kind = n_NOWAY;
|
||||
sprintf(scratchbuf, "%s is missing the prerequisite%s %s",
|
||||
node->n_name, length(miss_anay)==1? "": "s", list_names(miss_anay));
|
||||
add_error(node, new_name(scratchbuf), miss_anay, FALSE);
|
||||
}
|
||||
or (! found)
|
||||
{
|
||||
node->n_kind = n_NOWAY;
|
||||
if (miss_ayea == (List *) NULL)
|
||||
sprintf(scratchbuf, "%s has no applicable entries with actions\n",
|
||||
node->n_name);
|
||||
else
|
||||
sprintf(scratchbuf, "%s is missing the ancestor%s %s",
|
||||
node->n_name, length(miss_ayea)==1? "": "s", list_names(miss_ayea));
|
||||
|
||||
add_error(node, new_name(scratchbuf), miss_ayea, FALSE);
|
||||
}
|
||||
or (on_node(node, nf_EXIST) && node->n_utime <= node->n_rtime)
|
||||
node->n_kind = n_OK;
|
||||
or (on_node(node, nf_PSEUDO) && length(node->n_act) == 0)
|
||||
{
|
||||
node->n_kind = n_OK;
|
||||
for_list (ptr, node->n_old)
|
||||
{
|
||||
onode = (Node *) ldata(ptr);
|
||||
if (is_cando(onode))
|
||||
node->n_kind = n_CANDO;
|
||||
}
|
||||
}
|
||||
else
|
||||
node->n_kind = n_CANDO;
|
||||
|
||||
end:
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug)
|
||||
{
|
||||
printf("chase exit\n");
|
||||
print_node(node);
|
||||
}
|
||||
#endif
|
||||
|
||||
put_trail("do_chase", "finish");
|
||||
}
|
||||
|
||||
/*
|
||||
** Calculate the "update time" of the given node. The second arg
|
||||
** tells us whether we should set a flag for nonvolatile ancestors.
|
||||
*/
|
||||
|
||||
get_utime(node, planning)
|
||||
reg Node *node;
|
||||
reg bool planning;
|
||||
{
|
||||
extern time_t get_youngest(), cake_gettime();
|
||||
reg time_t youngest;
|
||||
|
||||
if ((youngest = get_youngest(node, planning)) == GENESIS)
|
||||
node->n_utime = cake_gettime();
|
||||
else
|
||||
node->n_utime = youngest;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the time of update of the youngest dependent.
|
||||
*/
|
||||
|
||||
time_t
|
||||
get_youngest(node, planning)
|
||||
reg Node *node;
|
||||
reg bool planning;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Node *onode;
|
||||
reg time_t youngest, picked_time;
|
||||
reg List *errnodes;
|
||||
|
||||
youngest = GENESIS;
|
||||
errnodes = NULL;
|
||||
for_list (ptr, node->n_old)
|
||||
{
|
||||
onode = (Node *) ldata(ptr);
|
||||
if (on_node(onode, nf_ERR))
|
||||
errnodes = addtail(errnodes, onode);
|
||||
else
|
||||
{
|
||||
if ((picked_time = pick_time(onode, planning)) > youngest)
|
||||
youngest = picked_time;
|
||||
}
|
||||
}
|
||||
|
||||
if (errnodes != (List *) NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "don't know what to do with %s because of problems with %s",
|
||||
node->n_name, list_names(errnodes));
|
||||
add_error(node, new_name(scratchbuf), errnodes, TRUE);
|
||||
}
|
||||
|
||||
return youngest;
|
||||
}
|
||||
|
||||
/*
|
||||
** Take care of the names mentioned alongside node's
|
||||
** on the left hand side of the given ground entry.
|
||||
**
|
||||
** If a node exists for one of these names we know that
|
||||
** a producer must have been chosen for it, and we know that
|
||||
** it is not this rule (if it were, then the caller would not
|
||||
** have done anything about buddies). This is an inconsistency.
|
||||
*/
|
||||
|
||||
set_buddies(node, entry)
|
||||
reg Node *node;
|
||||
reg Entry *entry;
|
||||
{
|
||||
extern Node *chase_node();
|
||||
reg List *list;
|
||||
reg List *ptr;
|
||||
reg Node *newnode;
|
||||
reg Pat *pat;
|
||||
reg List *errnodes;
|
||||
|
||||
put_trail("set_buddies", "start");
|
||||
list = makelist(node);
|
||||
errnodes = NULL;
|
||||
for_list (ptr, entry->e_new)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
if (streq(pat->p_str, node->n_name))
|
||||
continue;
|
||||
|
||||
if ((newnode = chase_node(pat->p_str)) != (Node *) NULL)
|
||||
errnodes = addtail(errnodes, newnode);
|
||||
else
|
||||
{
|
||||
newnode = chase(pat->p_str, pat->p_flag, entry);
|
||||
addtail(list, newnode); /* no assigment */
|
||||
}
|
||||
}
|
||||
|
||||
for_list (ptr, list)
|
||||
{
|
||||
newnode = (Node *) ldata(ptr);
|
||||
newnode->n_new = list;
|
||||
|
||||
if (errnodes != (List *) NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cannot update %s because of interference with %s %s",
|
||||
newnode->n_name, (length(errnodes) == 1)? "buddy": "buddies",
|
||||
list_names(errnodes));
|
||||
add_error(node, new_name(scratchbuf), errnodes, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
put_trail("set_buddies", "finish");
|
||||
}
|
||||
|
||||
/*
|
||||
** Pick the appropriate time to use in decisions
|
||||
** about dependencies. The algorithms differ in the
|
||||
** twp phases: in the execution phase real times
|
||||
** override any calculated times.
|
||||
*/
|
||||
|
||||
time_t
|
||||
pick_time(node, planning)
|
||||
reg Node *node;
|
||||
reg bool planning;
|
||||
{
|
||||
if (off_node(node, nf_EXIST))
|
||||
return node->n_utime;
|
||||
|
||||
if (planning)
|
||||
return max(node->n_rtime, node->n_utime);
|
||||
|
||||
return node->n_rtime;
|
||||
}
|
||||
|
||||
/*
|
||||
** Chase down the ancestors of the given name.
|
||||
** Return the node describing the dependency graph.
|
||||
**
|
||||
** Note that this is merely an interface function,
|
||||
** serving to cache previous results and to detect cycles.
|
||||
*/
|
||||
|
||||
char *goal_stack[MAXGSTACK];
|
||||
int goal_stackp = 0;
|
||||
|
||||
Node *
|
||||
chase(name, flag, picked)
|
||||
reg char *name;
|
||||
reg bool flag;
|
||||
reg Entry *picked;
|
||||
{
|
||||
extern Table node_tab;
|
||||
extern do_chase();
|
||||
extern char *find_circle();
|
||||
reg Node *node;
|
||||
|
||||
if ((node = (Node *) lookup_table(node_tab, name)) == NULL)
|
||||
{
|
||||
node = make_node(name);
|
||||
if (goal_stackp >= MAXGSTACK)
|
||||
{
|
||||
printf("cake: dependency nesting level %d too deep\n", goal_stackp);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
goal_stack[goal_stackp++] = name;
|
||||
#ifdef CAKEDEBUG
|
||||
cdebug("stack[%d] = %s\n", goal_stackp-1, goal_stack[goal_stackp-1]);
|
||||
#endif
|
||||
set_node(node, nf_BUSY);
|
||||
insert_table(node_tab, node);
|
||||
do_chase(node, picked);
|
||||
--goal_stackp;
|
||||
reset_node(node, nf_BUSY);
|
||||
}
|
||||
else
|
||||
{
|
||||
cdebug("Using cache for %s\n", name);
|
||||
if (on_node(node, nf_BUSY))
|
||||
{
|
||||
node->n_flag |= flag;
|
||||
sprintf(scratchbuf, "%s depends upon itself %s", node->n_name,
|
||||
find_circle(node->n_name));
|
||||
add_error(node, new_name(scratchbuf), LNULL, TRUE);
|
||||
put_trail("chase", "finish");
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
node->n_flag |= flag;
|
||||
put_trail("chase", "finish");
|
||||
return node;
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
** Cake configuration parameters.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
/* type used when type is not known */
|
||||
typedef int Cast;
|
||||
|
||||
/* location of the systemwide cake library */
|
||||
/*#define SLIB "/u/pgrad/zs/lib/cake" **BRL*/
|
||||
#define SLIB "/usr/brlcad/lib/cake"
|
||||
|
||||
/* suffix (after $HOME) of personal libraries */
|
||||
#define ULIB "/lib/cake"
|
||||
|
||||
/* command to invoke the C preprocessor */
|
||||
#define CPP "/lib/cpp"
|
||||
|
||||
/* location of the statistics file - if not defined, no stats kept */
|
||||
/*#define STATS_FILE "/u/pgrad/zs/lib/cake_stats" **BRL*/
|
||||
#define STATS_FILE "/usr/brlcad/lib/cake_stats"
|
||||
|
||||
/* characters always requiring shell attention */
|
||||
#define METACHARS "*?!&|;<>()[]{}'`\"%$~#"
|
||||
|
||||
/* default command to execute non-script shell actions */
|
||||
#define SYSTEM_CMD "/bin/csh -cf"
|
||||
|
||||
/* default command to execute shell scripts */
|
||||
#define SCRIPT_CMD "/bin/csh -f"
|
||||
|
||||
/* System V compatibility */
|
||||
#ifdef ATT
|
||||
/* the resolution of the times(2) system call */
|
||||
#ifdef exlsi
|
||||
#define TIMERES 100
|
||||
#else
|
||||
#define TIMERES 60
|
||||
#endif
|
||||
|
||||
#include "port.h"
|
||||
|
||||
#define vfork() fork()
|
||||
#define index(s, c) strchr(s, c)
|
||||
#define rindex(s, c) strrchr(s, c)
|
||||
#endif
|
||||
|
||||
#define MAXARGS 128 /* BRL, was 64 */
|
||||
#define MAXGSTACK 128
|
||||
#define MAXARGSIZE 128
|
||||
#define MAXPATSIZE 4096 /* BRL, was 512 */
|
||||
#define MAXLEXBUF 4096 /* BRL, was 2048 */
|
||||
#define MAXSIZE 4096 /* BRL, was 2048 */
|
||||
#define MAXSCRIPT 16384
|
||||
#define MAXNEST 8
|
||||
#define SIZE 97 /* size of tables */
|
||||
#define CHARSETSIZE 256
|
||||
#define GENESIS (time_t) 42 /* something distinctive */
|
||||
#define CHASEROOT "!MAINCAKE!"
|
||||
-559
@@ -1,559 +0,0 @@
|
||||
/*
|
||||
** Module to record and process Cake dependency entries.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <ctype.h>
|
||||
|
||||
List *entries;
|
||||
Entry *main_entry;
|
||||
|
||||
extern Test *ground_test();
|
||||
|
||||
#define ground_pat(env, pat) make_pat(ground(env, pat->p_str), pat->p_cmd, pat->p_flag);
|
||||
#define ground_act(env, act) make_act(ground(env, act->a_str), act->a_flag);
|
||||
|
||||
/*
|
||||
** Initialise ALL data structures about entries.
|
||||
*/
|
||||
|
||||
init_entry()
|
||||
{
|
||||
entries = makelist0();
|
||||
main_entry = (Entry *) NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Deposit an entry just read in.
|
||||
*/
|
||||
|
||||
new_entry(deps, acts)
|
||||
reg List *deps; /* of Entry */
|
||||
reg List *acts; /* of Pat */
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Entry *entry;
|
||||
|
||||
for_list (ptr, deps)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr);
|
||||
entry->e_act = acts;
|
||||
addtail(entries, entry); /* no assignment */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Prepare entries for matches against their left hand sides.
|
||||
** This essentially means dereferencing any command patterns.
|
||||
** Another minor correction is also done here: if -n is given
|
||||
** then we set nf_PRECIOUS so no file is deleted.
|
||||
*/
|
||||
|
||||
prep_entries()
|
||||
{
|
||||
extern List *break_pat();
|
||||
reg List *ptr, *ptr1;
|
||||
reg Entry *entry;
|
||||
reg Pat *pat;
|
||||
reg List *newnew;
|
||||
|
||||
for_list (ptr, entries)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr);
|
||||
|
||||
newnew = makelist0();
|
||||
for_list (ptr1, entry->e_new)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
if (on_pat(pat, nf_WHEN))
|
||||
{
|
||||
printf("cake: inappropriate flag '*' after target %s ignored\n",
|
||||
pat->p_str);
|
||||
reset_pat(pat, nf_WHEN);
|
||||
}
|
||||
|
||||
if (nflag)
|
||||
set_pat(pat, nf_PRECIOUS);
|
||||
|
||||
if (! pat->p_cmd)
|
||||
addtail(newnew, pat); /* na */
|
||||
else
|
||||
{
|
||||
deref(pat, TRUE);
|
||||
addlist(newnew, break_pat(pat));/* na */
|
||||
}
|
||||
}
|
||||
|
||||
entry->e_new = newnew;
|
||||
|
||||
for_list (ptr1, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
if (pat->p_cmd && on_pat(pat, nf_WHEN))
|
||||
{
|
||||
printf("cake: inappropriate flag '*' after command source %s ignored\n",
|
||||
pat->p_str);
|
||||
reset_pat(pat, nf_WHEN);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (entrydebug)
|
||||
{
|
||||
printf("prepared entry:\n");
|
||||
print_entry(entry);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Enter the last (main) entry. This entry has a distinguished
|
||||
** left hand side consisting of the sole pattern CHASEROOT.
|
||||
** This is the pattern which cake tries to make up-to-date.
|
||||
** If there were nonoption arguments on the command line,
|
||||
** CHASEROOT is made to depend on them; otherwise the left hand
|
||||
** side of the first concrete entry is used, as in make.
|
||||
** However, if the first concrete entry is in an included file,
|
||||
** we keep looking, unless it had a double colon.
|
||||
*/
|
||||
|
||||
final_entry(argc, argv)
|
||||
reg int argc;
|
||||
reg char *argv[];
|
||||
{
|
||||
extern bool hasvars();
|
||||
reg List *ptr, *ptr1;
|
||||
reg Entry *entry, *foundentry;
|
||||
reg Pat *pat;
|
||||
reg bool found_main, found_incl;
|
||||
reg int i;
|
||||
|
||||
main_entry = make(Entry);
|
||||
main_entry->e_new = makelist(make_pat(CHASEROOT, FALSE, nf_PSEUDO|nf_NODELETE));
|
||||
main_entry->e_old = makelist0();
|
||||
main_entry->e_cond = (Test *) NULL;
|
||||
main_entry->e_act = makelist0();
|
||||
|
||||
cdebug("target count %d\n", argc-1);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
cdebug("target %s\n", argv[i]);
|
||||
addtail(main_entry->e_old, make_pat(argv[i], FALSE, 0)); /* na */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* find the first entry without variables */
|
||||
found_main = FALSE;
|
||||
found_incl = FALSE;
|
||||
for_list (ptr, entries)
|
||||
{
|
||||
entry = (Entry *) ldata(ptr);
|
||||
for_list (ptr1, entry->e_new)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr1);
|
||||
if (hasvars(pat->p_str))
|
||||
goto nextentry;
|
||||
}
|
||||
|
||||
if (streq(entry->e_file, cakefile) || entry->e_dblc)
|
||||
{
|
||||
found_main = TRUE;
|
||||
foundentry = entry;
|
||||
break;
|
||||
}
|
||||
or (! found_incl)
|
||||
{
|
||||
found_incl = TRUE;
|
||||
foundentry = entry;
|
||||
}
|
||||
|
||||
nextentry: ;
|
||||
}
|
||||
|
||||
if (! found_main && ! found_incl)
|
||||
{
|
||||
printf("cake: no entries without variables\n");
|
||||
printf("cake: don't know what cake to bake\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* update everything on its left side */
|
||||
for_list (ptr, foundentry->e_new)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
addtail(main_entry->e_old, pat); /* na */
|
||||
}
|
||||
}
|
||||
|
||||
addtail(entries, main_entry); /* no assigment */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Return a new entry which is a ground version of the one passed.
|
||||
** Process '*' flags and set up e_when accordingly.
|
||||
*/
|
||||
|
||||
Entry *
|
||||
ground_entry(env, entry)
|
||||
Env env;
|
||||
reg Entry *entry;
|
||||
{
|
||||
extern do_when();
|
||||
extern List *break_pat();
|
||||
extern char *ground();
|
||||
reg List *ptr;
|
||||
reg Entry *newentry;
|
||||
reg Pat *pat, *newpat;
|
||||
reg Act *act, *newact;
|
||||
|
||||
put_trail("ground_entry", "start");
|
||||
newentry = make(Entry);
|
||||
newentry->e_new = makelist0();
|
||||
newentry->e_old = makelist0();
|
||||
newentry->e_act = makelist0();
|
||||
newentry->e_when = makelist0();
|
||||
|
||||
for_list (ptr, entry->e_new)
|
||||
{
|
||||
/* prep_entries made these patterns command free */
|
||||
pat = (Pat *) ldata(ptr);
|
||||
newpat = ground_pat(env, pat);
|
||||
do_when(newentry, newpat);
|
||||
addtail(newentry->e_new, newpat); /* na */
|
||||
}
|
||||
|
||||
for_list (ptr, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
newpat = ground_pat(env, pat);
|
||||
do_when(newentry, newpat);
|
||||
addtail(newentry->e_old, newpat); /* na */
|
||||
}
|
||||
|
||||
for_list (ptr, entry->e_act)
|
||||
{
|
||||
act = (Act *) ldata(ptr);
|
||||
newact = ground_act(env, act);
|
||||
addtail(newentry->e_act, newact); /* na */
|
||||
}
|
||||
|
||||
newentry->e_cond = ground_test(env, entry->e_cond);
|
||||
|
||||
put_trail("ground_entry", "finish");
|
||||
return newentry;
|
||||
}
|
||||
|
||||
/*
|
||||
** Look after '*' (when) flags.
|
||||
*/
|
||||
|
||||
do_when(entry, pat)
|
||||
reg Entry *entry;
|
||||
reg Pat *pat;
|
||||
{
|
||||
if (on_pat(pat, nf_WHEN))
|
||||
{
|
||||
reset_pat(pat, nf_WHEN);
|
||||
entry->e_when = addtail(entry->e_when, pat);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Ground a test.
|
||||
*/
|
||||
|
||||
Test *
|
||||
ground_test(env, test)
|
||||
Env env;
|
||||
reg Test *test;
|
||||
{
|
||||
extern char *ground();
|
||||
reg List *ptr;
|
||||
reg Pat *pat, *newpat;
|
||||
reg Test *newtest;
|
||||
|
||||
if (test == (Test *) NULL)
|
||||
return test;
|
||||
|
||||
put_trail("ground_test", "start");
|
||||
switch (test->t_kind)
|
||||
{
|
||||
|
||||
when t_TRUE:
|
||||
case t_FALSE: put_trail("ground_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_AND:
|
||||
case t_OR: put_trail("ground_test", "finish");
|
||||
return make_test_b(test->t_kind,
|
||||
ground_test(env, test->t_left), ground_test(env, test->t_right));
|
||||
|
||||
when t_NOT: put_trail("ground_test", "finish");
|
||||
return make_test_u(test->t_kind, ground_test(env, test->t_left));
|
||||
|
||||
when t_CMD: put_trail("ground_test", "finish");
|
||||
return make_test_c(ground(env, test->t_cmd));
|
||||
|
||||
when t_MATCH: pat = ground_pat(env, test->t_pat);
|
||||
newtest = make_test_mm(pat);
|
||||
for_list (ptr, test->t_list)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
newpat = ground_pat(env, pat);
|
||||
addtail(newtest->t_list, newpat); /* na */
|
||||
}
|
||||
|
||||
put_trail("ground_test", "finish");
|
||||
return newtest;
|
||||
|
||||
when t_LIST: pat = ground_pat(env, test->t_pat);
|
||||
newtest = make_test_l(pat, makelist0());
|
||||
for_list (ptr, test->t_list)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
newpat = ground_pat(env, pat);
|
||||
addtail(newtest->t_list, newpat); /* na */
|
||||
}
|
||||
|
||||
put_trail("ground_test", "finish");
|
||||
return newtest;
|
||||
|
||||
when t_EXIST: newpat = ground_pat(env, test->t_pat);
|
||||
put_trail("ground_test", "finish");
|
||||
return make_test_s(t_EXIST, newpat);
|
||||
|
||||
when t_CANDO: newpat = ground_pat(env, test->t_pat);
|
||||
put_trail("ground_test", "finish");
|
||||
return make_test_s(t_CANDO, newpat);
|
||||
|
||||
when t_OK: newpat = ground_pat(env, test->t_pat);
|
||||
put_trail("ground_test", "finish");
|
||||
return make_test_s(t_OK, newpat);
|
||||
|
||||
otherwise: printf("cake internal error: bad test type %x in ground_test\n", test->t_kind);
|
||||
put_trail("ground_test", "finish");
|
||||
return (Test *) NULL;
|
||||
}
|
||||
|
||||
put_trail("ground_test", "finish");
|
||||
return (Test *) NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Dereference all command patterns in the given entry.
|
||||
*/
|
||||
|
||||
deref_entry(env, entry)
|
||||
Env env;
|
||||
reg Entry *entry;
|
||||
{
|
||||
reg List *ptr, *ptr1;
|
||||
reg List *newlist;
|
||||
reg List *patlist;
|
||||
reg Pat *pat, *oldpat, *newpat;
|
||||
|
||||
newlist = makelist0();
|
||||
for_list (ptr, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
if (! pat->p_cmd)
|
||||
addtail(newlist, pat); /* na */
|
||||
else
|
||||
{
|
||||
deref(pat, TRUE);
|
||||
patlist = break_pat(pat);
|
||||
for_list (ptr1, patlist)
|
||||
{
|
||||
oldpat = (Pat *) ldata(ptr1);
|
||||
newpat = make_pat(ground(env, oldpat->p_str), FALSE, 0);
|
||||
do_when(entry, newpat);
|
||||
addtail(newlist, newpat); /* na */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entry->e_old = newlist;
|
||||
}
|
||||
|
||||
/*
|
||||
** Dereference a test.
|
||||
*/
|
||||
|
||||
Test *
|
||||
deref_test(test)
|
||||
reg Test *test;
|
||||
{
|
||||
extern char *expand_cmds();
|
||||
reg List *ptr;
|
||||
reg List *newlist;
|
||||
reg Pat *pat;
|
||||
|
||||
if (test == (Test *) NULL)
|
||||
return test;
|
||||
|
||||
put_trail("deref_test", "start");
|
||||
switch (test->t_kind)
|
||||
{
|
||||
|
||||
when t_TRUE:
|
||||
case t_FALSE: put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_AND:
|
||||
case t_OR: test->t_left = deref_test(test->t_left);
|
||||
test->t_right = deref_test(test->t_right);
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_NOT: test->t_left = deref_test(test->t_left);
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_CMD: test->t_cmd = expand_cmds(test->t_cmd);
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_MATCH: deref(test->t_pat, FALSE);
|
||||
for_list (ptr, test->t_list)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
deref(pat, FALSE);
|
||||
}
|
||||
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_LIST: deref(test->t_pat, FALSE);
|
||||
newlist = makelist0();
|
||||
for_list (ptr, test->t_list)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
if (! pat->p_cmd)
|
||||
addtail(newlist, pat); /* na */
|
||||
else
|
||||
{
|
||||
deref(pat, TRUE);
|
||||
addlist(newlist, break_pat(pat)); /* na */
|
||||
}
|
||||
}
|
||||
|
||||
test->t_list = newlist;
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_EXIST: deref(test->t_pat, FALSE);
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_CANDO: deref(test->t_pat, FALSE);
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
when t_OK: deref(test->t_pat, FALSE);
|
||||
put_trail("deref_test", "finish");
|
||||
return test;
|
||||
|
||||
otherwise: printf("cake internal error: bad test type %x in deref_test\n", test->t_kind);
|
||||
put_trail("deref_test", "finish");
|
||||
return (Test *) NULL;
|
||||
}
|
||||
|
||||
put_trail("deref_test", "finish");
|
||||
return (Test *) NULL;
|
||||
}
|
||||
|
||||
Act *
|
||||
prep_act(text)
|
||||
reg char *text;
|
||||
{
|
||||
reg Act *act;
|
||||
reg char *s;
|
||||
|
||||
act = make(Act);
|
||||
act->a_flag = 0;
|
||||
|
||||
/* strip trailing space - there is at least the newline */
|
||||
for (s = text+strlen(text)-1; isspace(*s); s--)
|
||||
*s = '\0';
|
||||
|
||||
/* put just the newline back */
|
||||
strcat(s, "\n");
|
||||
|
||||
/* strip spaces before flags */
|
||||
for (s = text; isspace(*s); s++)
|
||||
;
|
||||
|
||||
/* process the flags */
|
||||
for (; *s != '\0'; s++)
|
||||
if (*s == '@')
|
||||
set_act(act, af_SILENT);
|
||||
or (*s == '!')
|
||||
set_act(act, af_SYSTEM);
|
||||
or (*s == '-')
|
||||
set_act(act, af_IGNORE);
|
||||
or (*s == '+')
|
||||
set_act(act, af_MINUSN);
|
||||
else
|
||||
break;
|
||||
|
||||
/* strip spaces after flags */
|
||||
for (; isspace(*s); s++)
|
||||
;
|
||||
|
||||
act->a_str = new_name(s);
|
||||
return act;
|
||||
}
|
||||
|
||||
Act *
|
||||
prep_script(first_act, middle_act, last_act)
|
||||
reg Act *first_act, *last_act;
|
||||
reg List *middle_act;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Act *act;
|
||||
reg char *s;
|
||||
char buf[MAXSCRIPT];
|
||||
|
||||
buf[0] = '\0';
|
||||
/* handle the first action */
|
||||
for (s = first_act->a_str+1; *s == ' ' || *s == '\t'; s++)
|
||||
;
|
||||
|
||||
if (strdiff(s, "\n"))
|
||||
strcat(buf, s);
|
||||
|
||||
/* handle the middle actions, if any */
|
||||
for_list (ptr, middle_act)
|
||||
{
|
||||
act = (Act *) ldata(ptr);
|
||||
strcat(buf, act->a_str);
|
||||
}
|
||||
|
||||
/* handle the last action as the first */
|
||||
for (s = last_act->a_str+1; *s == ' ' || *s == '\t'; s++)
|
||||
;
|
||||
|
||||
if (strdiff(s, "\n"))
|
||||
strcat(buf, s);
|
||||
|
||||
/* check for overflow */
|
||||
if (strlen(buf) > MAXSCRIPT)
|
||||
{
|
||||
printf("cake: script too long\n");
|
||||
printf("%s", buf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
first_act->a_str = new_name(buf);
|
||||
set_act(first_act, af_SCRIPT);
|
||||
return first_act;
|
||||
}
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
** Error handling module.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** This function prints out the history of errors
|
||||
** that prevent the proper update of the given node.
|
||||
*/
|
||||
|
||||
trace_errs(node)
|
||||
reg Node *node;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Node *bnode;
|
||||
|
||||
if (on_node(node, nf_TRACED))
|
||||
return;
|
||||
|
||||
set_node(node, nf_TRACED);
|
||||
for_list (ptr, node->n_badguys)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
trace_errs(bnode);
|
||||
}
|
||||
|
||||
if (strdiff(node->n_name, CHASEROOT))
|
||||
printf("%s", node->n_msg);
|
||||
}
|
||||
|
||||
/*
|
||||
** This function adds msg to the list of error messages
|
||||
** to be printed by trace_errs for the given node.
|
||||
*/
|
||||
|
||||
add_error(node, msg, badguys, iserror)
|
||||
reg Node *node;
|
||||
reg char *msg;
|
||||
reg List *badguys;
|
||||
reg int iserror;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
|
||||
if (node->n_msg == NULL)
|
||||
node->n_msg = "";
|
||||
|
||||
if (iserror)
|
||||
set_node(node, nf_ERR);
|
||||
|
||||
sprintf(buf, "%scake: %s\n", node->n_msg, msg);
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: buffer overflow in add_error\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
node->n_msg = new_name(buf);
|
||||
node->n_badguys = addlist(node->n_badguys, badguys);
|
||||
}
|
||||
|
||||
char *
|
||||
find_circle(name)
|
||||
reg char *name;
|
||||
{
|
||||
extern int goal_stackp;
|
||||
extern char *goal_stack[];
|
||||
char buf[MAXSIZE];
|
||||
reg int i;
|
||||
|
||||
cdebug("stackp = %d\n", goal_stackp);
|
||||
cdebug("looking for %s\n", goal_stack[goal_stackp-1]);
|
||||
|
||||
if (goal_stack[goal_stackp-1] == name)
|
||||
return "directly";
|
||||
|
||||
for (i = 0; i < goal_stackp; i++)
|
||||
{
|
||||
cdebug("checking %d: %s\n", i, goal_stack[i]);
|
||||
if (goal_stack[i] == name)
|
||||
{
|
||||
cdebug("hit\n");
|
||||
strcpy(buf, "through");
|
||||
for (; i < goal_stackp; i++)
|
||||
{
|
||||
strcat(buf, " ");
|
||||
strcat(buf, goal_stack[i]);
|
||||
}
|
||||
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: buffer overflow in find_circle\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
return new_name(buf);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "cake internal error: no circularity in find_circle\n");
|
||||
exit_cake(TRUE);
|
||||
return ""; /* to satisfy lint */
|
||||
}
|
||||
|
||||
char *
|
||||
list_names(list)
|
||||
reg List *list; /* of Node */
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Node *node;
|
||||
reg char *sep;
|
||||
char buf[MAXSIZE];
|
||||
|
||||
buf[0] = '\0';
|
||||
sep = "";
|
||||
for_list (ptr, list)
|
||||
{
|
||||
node = (Node *) ldata(ptr);
|
||||
strcat(buf, sep);
|
||||
strcat(buf, node->n_name);
|
||||
sep = " ";
|
||||
}
|
||||
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: buffer overflow in list_names\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
return new_name(buf);
|
||||
}
|
||||
-276
@@ -1,276 +0,0 @@
|
||||
/*
|
||||
** Module to expand out commands in patterns and actions.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
** Expand any commands in actions. Doing this here instead of
|
||||
** in the shell saves time because of cake's command cache.
|
||||
*/
|
||||
|
||||
char *
|
||||
expand_cmds(str)
|
||||
reg char *str;
|
||||
{
|
||||
extern char *get_output();
|
||||
reg char *s;
|
||||
reg int n, cmds, offset;
|
||||
reg int stackp;
|
||||
reg char *rightbr;
|
||||
char *leftbr_stack[MAXNEST];
|
||||
char *nextbr_stack[MAXNEST];
|
||||
char copybuf[MAXSIZE], buf[MAXSIZE];
|
||||
reg char *result;
|
||||
|
||||
if (index(str, '[') == NULL)
|
||||
return str;
|
||||
|
||||
put_trail("expand_cmds", "start");
|
||||
cmds = 0;
|
||||
stackp = 0;
|
||||
if (strlen(str) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: command too long %s\n", str);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
strcpy(copybuf, str);
|
||||
leftbr_stack[stackp] = copybuf;
|
||||
nextbr_stack[stackp] = NULL;
|
||||
|
||||
/* Leftbr_stack[stackp] and rightbr enclose commands */
|
||||
/* for stackp > 0; for stackp == 0 they enclose the string */
|
||||
/* Nextbr_stack gives the beginning of the next segment */
|
||||
/* after the corresponding leftbr; == 0 if not known (yet) */
|
||||
/* The top entry on the stack always has nextbr == NULL */
|
||||
|
||||
for (s = copybuf; s[0] != '\0'; s++)
|
||||
{
|
||||
if (s[0] == '[' && s[1] == '[')
|
||||
{
|
||||
nextbr_stack[stackp] = s;
|
||||
if (++stackp >= MAXNEST)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: command nesting level too deep\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
leftbr_stack[stackp] = s;
|
||||
nextbr_stack[stackp] = NULL;
|
||||
s++; /* avoid problems with [[[cmd]] ... */
|
||||
}
|
||||
or (s[0] == ']' && s[1] == ']')
|
||||
{
|
||||
if (stackp <= 0)
|
||||
continue;
|
||||
|
||||
cmds++;
|
||||
rightbr = s;
|
||||
|
||||
leftbr_stack[stackp][0] = '\0';
|
||||
leftbr_stack[stackp][1] = '\0';
|
||||
rightbr[0] = '\0';
|
||||
rightbr[1] = '\0';
|
||||
|
||||
result = get_output(new_name(leftbr_stack[stackp]+2));
|
||||
cdebug("expansion [[%s]] => [[%s]]\n", leftbr_stack[stackp]+2, result);
|
||||
|
||||
segcpy(buf, leftbr_stack[stackp-1], nextbr_stack[stackp-1]);
|
||||
strcat(buf, result);
|
||||
offset = strlen(buf) - 1;
|
||||
strcat(buf, rightbr+2);
|
||||
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake: expansion result '%s' is too long\n", buf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
stackp--;
|
||||
leftbr_stack[stackp] = new_name(buf);
|
||||
nextbr_stack[stackp] = NULL;
|
||||
|
||||
/* start next iteration with the */
|
||||
/* first character after the ]] */
|
||||
s = leftbr_stack[stackp] + offset;
|
||||
}
|
||||
or (s[0] == '\\')
|
||||
{
|
||||
/* don't check next char */
|
||||
if (s[1] != '\0')
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (entrydebug)
|
||||
printf("after expand_cmds: [[%s]]\n", str);
|
||||
#endif
|
||||
|
||||
if (cmds <= 0)
|
||||
{
|
||||
put_trail("expand_cmds", "finish");
|
||||
return str;
|
||||
}
|
||||
or (stackp == 0)
|
||||
{
|
||||
put_trail("expand_cmds", "finish");
|
||||
return leftbr_stack[0];
|
||||
}
|
||||
|
||||
segcpy(buf, leftbr_stack[0], nextbr_stack[0]);
|
||||
for (n = 1; n <= stackp; n++)
|
||||
segcat(buf, leftbr_stack[n], nextbr_stack[n]);
|
||||
|
||||
if (strlen(buf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake: expansion result '%s' is too long\n", buf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
put_trail("expand_cmds", "finish");
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
segcpy(target, left, right)
|
||||
reg char *target, *left, *right;
|
||||
{
|
||||
reg int i;
|
||||
reg char *s;
|
||||
|
||||
if (right == NULL)
|
||||
strcpy(target, left);
|
||||
else
|
||||
{
|
||||
for (s = left, i = 0; s != right; s++, i++)
|
||||
target[i] = *s;
|
||||
|
||||
target[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
segcat(target, left, right)
|
||||
reg char *target, *left, *right;
|
||||
{
|
||||
reg int i;
|
||||
reg char *s;
|
||||
|
||||
if (right == NULL)
|
||||
strcat(target, left);
|
||||
else
|
||||
{
|
||||
for (s = left, i = strlen(target); s != right; s++, i++)
|
||||
target[i] = *s;
|
||||
|
||||
target[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Execute the given command and return its output.
|
||||
** It is a fatal error for the command to terminate abnormally.
|
||||
*/
|
||||
|
||||
char *
|
||||
get_output(cmd)
|
||||
reg char *cmd;
|
||||
{
|
||||
extern char *mktemp();
|
||||
extern char *get_out();
|
||||
extern char *flatten();
|
||||
extern int cake_proc();
|
||||
extern Wait cake_wait();
|
||||
char buf[MAXSIZE];
|
||||
Wait code;
|
||||
reg char *out_filename;
|
||||
reg FILE *fp;
|
||||
reg int i, c;
|
||||
reg int pid;
|
||||
reg char *s, *result;
|
||||
|
||||
put_trail("get_output", "start");
|
||||
cdebug("get_output of [%s]\n", cmd);
|
||||
|
||||
/* see if we have tried this command before */
|
||||
if ((result = get_out(cmd)) != NULL)
|
||||
{
|
||||
cdebug("cache yields [%s]\n", result);
|
||||
put_trail("get_output", "early finish");
|
||||
return result;
|
||||
}
|
||||
|
||||
out_filename = get_newname();
|
||||
pid = cake_proc(cmd, Exec, out_filename, (Node *) NULL, (int (*)()) NULL, (List *) NULL);
|
||||
code = cake_wait(pid);
|
||||
if (code.w_status != 0 && ! zflag)
|
||||
{
|
||||
printf("cake, %s: nonzero exit status\n", cmd);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
if ((fp = fopen(out_filename, "r")) == NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, fopen %s", out_filename);
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
/* convert the chars in file fp to a string */
|
||||
i = 0;
|
||||
while ((c = getc(fp)) != EOF)
|
||||
buf[i++] = c;
|
||||
|
||||
buf[i] = '\0';
|
||||
fclose(fp);
|
||||
if (MAXSIZE <= i)
|
||||
{
|
||||
printf("cake, %s: output too long\n", cmd);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
#ifndef LEAVE_DIR
|
||||
cdebug("get_output unlink out_filename %s\n", out_filename);
|
||||
if (unlink(out_filename) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, unlink %s", out_filename);
|
||||
perror(scratchbuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* save the result for posterity */
|
||||
s = new_name(flatten(buf));
|
||||
new_out(cmd, s);
|
||||
cdebug("put result [%s] into cache\n", s);
|
||||
put_trail("get_output", "finish");
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
** Flatten the output of commands by converting newlines to spaces
|
||||
** and by removing blanks around the edges.
|
||||
*/
|
||||
|
||||
char *
|
||||
flatten(str)
|
||||
reg char *str;
|
||||
{
|
||||
reg char *s;
|
||||
|
||||
/* convert newlines (and formfeeds) to spaces */
|
||||
for (s = str; *s != '\0'; s++)
|
||||
if (*s == '\n' || *s == '\f')
|
||||
*s = ' ';
|
||||
|
||||
/* remove blanks around the edges */
|
||||
for (s = str+strlen(str)-1; str <= s && isspace(*s); s--)
|
||||
*s = '\0';
|
||||
for (s = str; *s != '\0' && isspace(*s); s++)
|
||||
;
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
** External definitions for Cake.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
/* library functions */
|
||||
extern char *malloc();
|
||||
#ifdef ATT
|
||||
extern char *strchr();
|
||||
extern char *strrchr();
|
||||
#else
|
||||
extern char *index();
|
||||
extern char *rindex();
|
||||
#endif
|
||||
|
||||
/* memory management */
|
||||
extern Cast newmem();
|
||||
extern oldmem();
|
||||
|
||||
/* make routines */
|
||||
extern Node *make_node();
|
||||
extern Entry *make_dep();
|
||||
extern Test *make_test_mm();
|
||||
extern Test *make_test_m();
|
||||
extern Test *make_test_c();
|
||||
extern Test *make_test_s();
|
||||
extern Test *make_test_l();
|
||||
extern Test *make_test_b();
|
||||
extern Test *make_test_u();
|
||||
extern Pat *make_pat();
|
||||
extern Act *make_act();
|
||||
|
||||
extern Act *prep_act();
|
||||
extern Act *prep_script();
|
||||
|
||||
/* table handling routines */
|
||||
extern init_sym();
|
||||
extern char *new_name();
|
||||
|
||||
/* printout routines */
|
||||
extern char scratchbuf[];
|
||||
extern print_pat();
|
||||
extern print_test();
|
||||
extern print_entry();
|
||||
extern print_node();
|
||||
|
||||
/* flags */
|
||||
extern int Gflag;
|
||||
extern int Lflag;
|
||||
extern int Rflag;
|
||||
extern int Xflag;
|
||||
extern int bflag;
|
||||
extern int cflag;
|
||||
extern int dflag;
|
||||
extern int gflag;
|
||||
extern int iflag;
|
||||
extern int kflag;
|
||||
extern int nflag;
|
||||
extern int qflag;
|
||||
extern int rflag;
|
||||
extern int sflag;
|
||||
extern int tflag;
|
||||
extern int vflag;
|
||||
extern int wflag;
|
||||
extern int xflag;
|
||||
extern int zflag;
|
||||
|
||||
extern int cakedebug;
|
||||
extern int entrydebug;
|
||||
extern int patdebug;
|
||||
extern int lexdebug;
|
||||
|
||||
/* misc global vars */
|
||||
extern char *cakefile;
|
||||
extern int maxprocs;
|
||||
|
||||
/* misc functions */
|
||||
extern char *get_newname();
|
||||
extern put_trail();
|
||||
extern get_trail();
|
||||
-637
@@ -1,637 +0,0 @@
|
||||
/*
|
||||
** File system interface module.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef ATT
|
||||
#include <sys/dir.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
typedef struct timeval Tval;
|
||||
typedef struct timezone Tzone;
|
||||
typedef struct stat Stat;
|
||||
typedef struct direct Dirent;
|
||||
|
||||
extern int errno;
|
||||
|
||||
static char dir_name[30] = "/tmp/CakeXXXXXX";
|
||||
|
||||
/*
|
||||
** Create the directory to be used for all temporary storage.
|
||||
*/
|
||||
|
||||
dir_start()
|
||||
{
|
||||
reg bool successful;
|
||||
|
||||
mktemp(dir_name);
|
||||
|
||||
#ifdef ATT
|
||||
{
|
||||
extern int cake_proc();
|
||||
extern Wait cake_wait();
|
||||
reg int pid;
|
||||
Wait code;
|
||||
|
||||
sprintf(scratchbuf, "mkdir %s", dir_name);
|
||||
pid = cake_proc(new_name(scratchbuf), Exec, (char *) NULL,
|
||||
(Node *) NULL, (int (*)()) NULL, (List *) NULL);
|
||||
code = cake_wait(pid);
|
||||
successful = code.w_status == 0;
|
||||
}
|
||||
#else
|
||||
successful = mkdir(dir_name, 0700) == 0;
|
||||
#endif
|
||||
|
||||
if (! successful)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, mkdir %s", dir_name);
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
#ifdef ATT
|
||||
if (chmod(dir_name, 0700) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, chmod 700 %s", dir_name);
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** Clean up /tmp when we are finished
|
||||
*/
|
||||
|
||||
dir_finish()
|
||||
{
|
||||
#ifndef LEAVE_DIR
|
||||
#ifdef ATT
|
||||
extern int cake_proc();
|
||||
extern Wait cake_wait();
|
||||
reg int pid;
|
||||
Wait code;
|
||||
|
||||
sprintf(scratchbuf, "/bin/rm -fr %s", dir_name);
|
||||
pid = cake_proc(new_name(scratchbuf), Exec, (char *) NULL,
|
||||
(Node *) NULL, (int (*)()) NULL, (List *) NULL);
|
||||
code = cake_wait(pid);
|
||||
if (code.w_status != 0)
|
||||
{
|
||||
fprintf(stderr, "cake system error: cannot remove %s\n", dir_name);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
char buf[1024];
|
||||
reg DIR *dirp;
|
||||
reg Dirent *dp;
|
||||
reg int nameoffset;
|
||||
|
||||
if ((dirp = opendir(dir_name)) == NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, opendir %s", dir_name);
|
||||
perror(scratchbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(buf, dir_name);
|
||||
strcat(buf, "/");
|
||||
nameoffset = strlen(buf);
|
||||
|
||||
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
|
||||
if (strdiff(dp->d_name, ".") && strdiff(dp->d_name, ".."))
|
||||
{
|
||||
buf[nameoffset] = '\0';
|
||||
strcat(buf, dp->d_name);
|
||||
cdebug("dir_finish unlink %s\n", buf);
|
||||
if (unlink(buf) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, unlink %s", buf);
|
||||
perror(scratchbuf);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dirp);
|
||||
|
||||
cdebug("rmdir %s\n", dir_name);
|
||||
if (rmdir(dir_name) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, rmdir %s", dir_name);
|
||||
perror(scratchbuf);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** Get a new filename in our private directory.
|
||||
** These files are used to store shell scripts
|
||||
** and the output of actions.
|
||||
**
|
||||
** These names MUST be different from those generated
|
||||
** by get_savename, so they have different prefixes.
|
||||
*/
|
||||
|
||||
char *
|
||||
get_newname()
|
||||
{
|
||||
char buf[100];
|
||||
static int count = 0;
|
||||
|
||||
++count;
|
||||
sprintf(buf, "%s/gen_%d", dir_name, count);
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
** Save a nonvolatile file for later comparison.
|
||||
** Any slashes in the filename are replaced by colons
|
||||
** to avoid reference to nonexistent directories.
|
||||
*/
|
||||
|
||||
save_novol(node)
|
||||
reg Node *node;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg FILE *ifp, *ofp;
|
||||
reg int c;
|
||||
|
||||
if (nflag)
|
||||
{
|
||||
node->n_stime = node->n_rtime;
|
||||
return;
|
||||
}
|
||||
|
||||
put_trail("save_novol", "start");
|
||||
cdebug("saving %s\n", node->n_name);
|
||||
node->n_stime = node->n_rtime;
|
||||
|
||||
get_savename(node->n_name, buf);
|
||||
if ((ifp = fopen(node->n_name, "r")) == NULL)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
cdebug("%s does not exist, considered volatile\n", node->n_name);
|
||||
reset_node(node, nf_NONVOL);
|
||||
put_trail("save_novol", "finish");
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(scratchbuf, "cake system error, fopen (r) %s", node->n_name);
|
||||
perror(scratchbuf);
|
||||
printf("cake: considering %s volatile\n", node->n_name);
|
||||
reset_node(node, nf_NONVOL);
|
||||
put_trail("save_novol", "finish");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ofp = fopen(buf, "w")) == NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, fopen (w) %s", buf);
|
||||
perror(scratchbuf);
|
||||
printf("cake: considering %s volatile\n", node->n_name);
|
||||
reset_node(node, nf_NONVOL);
|
||||
put_trail("save_novol", "finish");
|
||||
return;
|
||||
}
|
||||
|
||||
while ((c = getc(ifp)) != EOF)
|
||||
putc(c, ofp);
|
||||
|
||||
fclose(ifp);
|
||||
fclose(ofp);
|
||||
put_trail("save_novol", "finish");
|
||||
}
|
||||
|
||||
/*
|
||||
** See if the given file has been changed since saved.
|
||||
*/
|
||||
|
||||
bool
|
||||
diff_novol(node)
|
||||
reg Node *node;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg FILE *i1fp, *i2fp;
|
||||
reg int c;
|
||||
reg bool diff;
|
||||
|
||||
if (nflag)
|
||||
return FALSE;
|
||||
|
||||
put_trail("diff_novol", "start");
|
||||
cdebug("comparing saved copy of %s: ", node->n_name);
|
||||
|
||||
get_savename(node->n_name, buf);
|
||||
if ((i1fp = fopen(node->n_name, "r")) == NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, fopen (r) %s", node->n_name);
|
||||
perror(scratchbuf);
|
||||
printf("cake: considering %s different\n", node->n_name);
|
||||
reset_node(node, nf_NONVOL);
|
||||
put_trail("diff_novol", "finish");
|
||||
return TRUE;;
|
||||
}
|
||||
|
||||
if ((i2fp = fopen(buf, "r")) == NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, fopen (r) %s", buf);
|
||||
perror(scratchbuf);
|
||||
printf("cake: considering %s different\n", node->n_name);
|
||||
reset_node(node, nf_NONVOL);
|
||||
put_trail("diff_novol", "finish");
|
||||
return TRUE;;
|
||||
}
|
||||
|
||||
diff = FALSE;
|
||||
while ((c = getc(i1fp)) != EOF)
|
||||
if (getc(i2fp) != c)
|
||||
{
|
||||
diff = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (getc(i2fp) != EOF)
|
||||
diff = TRUE;
|
||||
|
||||
fclose(i1fp);
|
||||
fclose(i2fp);
|
||||
cdebug("diff_novol unlink %s\n", buf);
|
||||
if (unlink(buf) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, unlink %s", buf);
|
||||
perror(scratchbuf);
|
||||
put_trail("diff_novol", "finish");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cdebug("%s\n", diff? "different": "same");
|
||||
put_trail("diff_novol", "finish");
|
||||
return diff;
|
||||
}
|
||||
|
||||
/*
|
||||
** Get the the name of the saved copy of the given file.
|
||||
*/
|
||||
|
||||
get_savename(name, buf)
|
||||
reg char *name;
|
||||
reg char buf[];
|
||||
{
|
||||
extern char *noslash();
|
||||
|
||||
strcpy(buf, dir_name);
|
||||
strcat(buf, "/save_");
|
||||
strcat(buf, noslash(name));
|
||||
}
|
||||
|
||||
/*
|
||||
** Remove any slashes from a filename.
|
||||
*/
|
||||
|
||||
char *
|
||||
noslash(name)
|
||||
reg char *name;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg int i;
|
||||
reg char *s;
|
||||
|
||||
i = 0;
|
||||
for (s = name; *s != '\0'; s++)
|
||||
if (*s == '/')
|
||||
buf[i++] = ':';
|
||||
else
|
||||
buf[i++] = *s;
|
||||
|
||||
buf[i] = '\0';
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
** Perform a stat on the given file. The only relevant info
|
||||
** is the return code, indicating whether the file exists or not
|
||||
** and its last modify (or status change) date. Note that if a
|
||||
** file does not exist, it is by definition volatile. An aside
|
||||
** considers all directories precious.
|
||||
*/
|
||||
|
||||
node_stat(node)
|
||||
reg Node *node;
|
||||
{
|
||||
extern int stat();
|
||||
Stat statbuf;
|
||||
|
||||
if (node->n_name != (char *) NULL && stat(node->n_name, &statbuf) == 0)
|
||||
{
|
||||
set_node(node, nf_EXIST);
|
||||
if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
|
||||
set_node(node, nf_PRECIOUS);
|
||||
|
||||
node->n_rtime = cflag? statbuf.st_ctime: statbuf.st_mtime;
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_node(node, nf_EXIST);
|
||||
reset_node(node, nf_NONVOL);
|
||||
node->n_rtime = GENESIS;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore the previous stat of a nonvol file,
|
||||
** both in the filesystem and in cake's memory.
|
||||
** However, make sure that it will not need to be
|
||||
** remade again and again to discover this anew
|
||||
** while its ancestors remain the same.
|
||||
*/
|
||||
|
||||
node_resetstat(node)
|
||||
reg Node *node;
|
||||
{
|
||||
node_stat(node);
|
||||
if (off_node(node, nf_EXIST))
|
||||
return;
|
||||
|
||||
cake_utimes(node, max(node->n_stime, node->n_utime));
|
||||
node->n_utime = node->n_rtime;
|
||||
}
|
||||
|
||||
/*
|
||||
** Set up the stat of a file as the latest ancestor's,
|
||||
** both in the filesystem and in cake's memory.
|
||||
*/
|
||||
|
||||
node_setstat(node)
|
||||
reg Node *node;
|
||||
{
|
||||
extern time_t get_youngest();
|
||||
reg time_t youngest;
|
||||
|
||||
node_stat(node);
|
||||
if (off_node(node, nf_EXIST))
|
||||
return;
|
||||
|
||||
youngest = get_youngest(node, FALSE);
|
||||
if (youngest != node->n_utime && youngest != GENESIS)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: youngest is mismatched for %s\n",
|
||||
node->n_name);
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
|
||||
cake_utimes(node, node->n_utime);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the time, converting formats.
|
||||
*/
|
||||
|
||||
time_t
|
||||
cake_gettime()
|
||||
{
|
||||
#ifdef ATT
|
||||
extern long time();
|
||||
long val;
|
||||
|
||||
if (time(&val) == -1)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, time");
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
return (time_t) val;
|
||||
#else
|
||||
Tzone tzone;
|
||||
Tval tval;
|
||||
|
||||
if (gettimeofday(&tval, &tzone) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, gettimeofday");
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
return (time_t) tval.tv_sec;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** Issue the system call utimes after expanding its arguments
|
||||
** from time_t to Tval. If the time given is GENESIS, use the
|
||||
** current time instead.
|
||||
*/
|
||||
|
||||
#ifdef ATT
|
||||
typedef struct utimbuf
|
||||
{
|
||||
time_t actime;
|
||||
time_t modtime;
|
||||
} Utimbuf;
|
||||
#endif
|
||||
|
||||
cake_utimes(node, newtime)
|
||||
reg Node *node;
|
||||
time_t newtime;
|
||||
{
|
||||
#ifdef ATT
|
||||
extern int utime();
|
||||
#else
|
||||
extern int utimes();
|
||||
#endif
|
||||
extern int stat();
|
||||
Stat statbuf;
|
||||
#ifdef ATT
|
||||
Utimbuf timbuf;
|
||||
long vals[2];
|
||||
#else
|
||||
Tzone tzone;
|
||||
Tval tvals[2];
|
||||
#endif
|
||||
|
||||
cdebug("resetting time for %s to %d, %s",
|
||||
node->n_name, newtime, ctime(&newtime));
|
||||
|
||||
#ifdef ATT
|
||||
if (time(&vals[0]) == -1)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, time");
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
#else
|
||||
if (gettimeofday(&tvals[0], &tzone) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, gettimeofday");
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (newtime == GENESIS)
|
||||
{
|
||||
cdebug("reinterpreting GENESIS\n");
|
||||
#ifdef ATT
|
||||
if (time(&vals[1]) == -1)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, time");
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
#else
|
||||
if (gettimeofday(&tvals[1], &tzone) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, gettimeofday");
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ATT
|
||||
vals[1] = (long) newtime;
|
||||
#else
|
||||
tvals[1].tv_sec = newtime;
|
||||
tvals[1].tv_usec = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ATT
|
||||
timbuf.actime = vals[0];
|
||||
timbuf.modtime = vals[1];
|
||||
node->n_rtime = vals[1];
|
||||
#else
|
||||
node->n_rtime = (time_t) tvals[1].tv_sec;
|
||||
#endif
|
||||
|
||||
if (nflag)
|
||||
return;
|
||||
|
||||
#ifdef ATT
|
||||
if (utime(node->n_name, &timbuf) != 0)
|
||||
#else
|
||||
if (utimes(node->n_name, tvals) != 0)
|
||||
#endif
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, utime(s) %s", node->n_name);
|
||||
perror(scratchbuf);
|
||||
fprintf(stderr, "cake: continuing\n");
|
||||
}
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug)
|
||||
{
|
||||
if (stat(node->n_name, &statbuf) != 0)
|
||||
printf("cannot verify utimes\n");
|
||||
else
|
||||
{
|
||||
print_time("accessed", statbuf.st_atime);
|
||||
print_time("modified", statbuf.st_mtime);
|
||||
print_time("changed ", statbuf.st_ctime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** See if the given file exists.
|
||||
*/
|
||||
|
||||
bool
|
||||
exist(name)
|
||||
reg char *name;
|
||||
{
|
||||
Stat statbuf;
|
||||
|
||||
if (stat(name, &statbuf) == 0)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
** Remove the given file.
|
||||
*/
|
||||
|
||||
cake_remove(name)
|
||||
reg char *name;
|
||||
{
|
||||
#ifdef CAREFUL
|
||||
if (! Xflag)
|
||||
{
|
||||
extern int getpid();
|
||||
extern int cake_proc();
|
||||
extern Wait cake_wait();
|
||||
extern char *noslash();
|
||||
reg int pid, cakepid;
|
||||
Stat statbuf;
|
||||
Wait code;
|
||||
char buf[80];
|
||||
|
||||
#ifndef ATT
|
||||
if (lstat(name, &statbuf) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, lstat %s", name);
|
||||
perror(scratchbuf);
|
||||
fprintf(stderr, "cake: continuing\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((statbuf.st_mode & S_IFMT) == S_IFLNK)
|
||||
{
|
||||
printf("removing the symbolic link %s\n", name);
|
||||
cdebug("cake_remove unlink %s\n", name);
|
||||
if (unlink(name) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, unlink %s", name);
|
||||
perror(scratchbuf);
|
||||
fprintf(stderr, "cake: continuing\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
cakepid = getpid();
|
||||
printf("moving %s to /tmp\n", name);
|
||||
sprintf(buf, "mv %s /tmp/%s.%d", name, noslash(name), cakepid);
|
||||
pid = cake_proc(buf, Exec, (char *) NULL, (Node *) NULL,
|
||||
(int (*)()) NULL, (List *) NULL);
|
||||
code = cake_wait(pid);
|
||||
if (code.w_status != 0)
|
||||
{
|
||||
fprintf(stderr, "cake system error: '%s' failed\n", buf);
|
||||
fprintf(stderr, "cake: continuing\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(buf, "/tmp/%s.%d", noslash(name), cakepid);
|
||||
if (chmod(buf, 0600) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, chmod %s", buf);
|
||||
perror(scratchbuf);
|
||||
fprintf(stderr, "cake: continuing\n");
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
cdebug("cake_remove unlink %s\n", name);
|
||||
if (unlink(name) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, unlink %s", name);
|
||||
perror(scratchbuf);
|
||||
fprintf(stderr, "cake: continuing\n");
|
||||
}
|
||||
}
|
||||
-171
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
** Linked list module.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** Make an empty list.
|
||||
*/
|
||||
|
||||
List *
|
||||
makelist0()
|
||||
{
|
||||
reg List *list;
|
||||
|
||||
list = make(List);
|
||||
ldata(list) = (Cast) 0;
|
||||
next(list) = list;
|
||||
prev(list) = list;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
** Make a list with the argument is its only element.
|
||||
*/
|
||||
|
||||
List *
|
||||
_makelist(data)
|
||||
reg Cast data;
|
||||
{
|
||||
return addhead(makelist0(), data);
|
||||
}
|
||||
|
||||
/*
|
||||
** Add some data to the head of a list.
|
||||
*/
|
||||
|
||||
List *
|
||||
_addhead(list, data)
|
||||
reg List *list;
|
||||
reg Cast data;
|
||||
{
|
||||
reg List *item;
|
||||
|
||||
if (list == NULL)
|
||||
list = makelist0();
|
||||
|
||||
item = make(List);
|
||||
ldata(item) = data;
|
||||
ldata(list) = (Cast) ((int) ldata(list) + 1);
|
||||
|
||||
/* item's pointers */
|
||||
next(item) = next(list);
|
||||
prev(item) = list;
|
||||
/* neighbours' pointers */
|
||||
next(prev(item)) = item;
|
||||
prev(next(item)) = item;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
** Add some data to the tail of a list.
|
||||
*/
|
||||
|
||||
List *
|
||||
_addtail(list, data)
|
||||
reg List *list;
|
||||
reg Cast data;
|
||||
{
|
||||
reg List *item;
|
||||
|
||||
if (list == NULL)
|
||||
list = makelist0();
|
||||
|
||||
item = make(List);
|
||||
ldata(item) = data;
|
||||
ldata(list) = (Cast) ((int) ldata(list) + 1);
|
||||
|
||||
/* item's pointers */
|
||||
next(item) = list;
|
||||
prev(item) = prev(list);
|
||||
/* neighbours' pointers */
|
||||
next(prev(item)) = item;
|
||||
prev(next(item)) = item;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destructively append list2 to list1. Since the header of
|
||||
** list2 is not meaningful after the operation, it is freed.
|
||||
*/
|
||||
|
||||
List *
|
||||
addlist(list1, list2)
|
||||
reg List *list1;
|
||||
reg List *list2;
|
||||
{
|
||||
if (list1 == NULL)
|
||||
list1 = makelist0();
|
||||
|
||||
if (list2 == NULL)
|
||||
list2 = makelist0();
|
||||
|
||||
if (length(list2) > 0)
|
||||
{
|
||||
if (length(list1) == 0)
|
||||
{
|
||||
ldata(list1) = ldata(list2);
|
||||
/* pointers from header */
|
||||
next(list1) = next(list2);
|
||||
prev(list1) = prev(list2);
|
||||
/* pointers to header */
|
||||
prev(next(list1)) = list1;
|
||||
next(prev(list1)) = list1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ldata(list1) = (Cast) ((int) ldata(list1) + (int) ldata(list2));
|
||||
/* end of list 1 to start of list 2 */
|
||||
next(prev(list1)) = next(list2);
|
||||
prev(next(list2)) = prev(list1);
|
||||
/* end of list 2 to start of list 1 */
|
||||
next(prev(list2)) = list1;
|
||||
prev(list1) = prev(list2);
|
||||
}
|
||||
}
|
||||
|
||||
oldmem((Cast) list2);
|
||||
return list1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the length of a given list.
|
||||
*/
|
||||
|
||||
int
|
||||
length(list)
|
||||
reg List *list;
|
||||
{
|
||||
if (list == NULL)
|
||||
return 0;
|
||||
|
||||
return (int) ldata(list);
|
||||
}
|
||||
|
||||
/*
|
||||
** Delete an item from its linked list, and free the node.
|
||||
*/
|
||||
|
||||
delete(list, item)
|
||||
reg List *list;
|
||||
reg List *item;
|
||||
{
|
||||
if (list == NULL)
|
||||
return;
|
||||
|
||||
if (item == NULL)
|
||||
return;
|
||||
|
||||
ldata(list) = (Cast) ((int) ldata(list) - 1);
|
||||
next(prev(item)) = next(item);
|
||||
prev(next(item)) = prev(item);
|
||||
|
||||
oldmem((Cast) item);
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
** Definitions for the list module.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
typedef struct s_list
|
||||
{
|
||||
Cast l_data;
|
||||
struct s_list *l_prev;
|
||||
struct s_list *l_next;
|
||||
} List;
|
||||
|
||||
#define next(ptr) (ptr)->l_next
|
||||
#define prev(ptr) (ptr)->l_prev
|
||||
#define ldata(ptr) (ptr)->l_data
|
||||
#define first_ptr(list) ((list)->l_next)
|
||||
#define last_ptr(list) ((list)->l_prev)
|
||||
#define first(list) ((list)->l_next->l_data)
|
||||
#define last(list) ((list)->l_prev->l_data)
|
||||
|
||||
#define for_list(p, l) for (p = (l? next(l): NULL); p != l && p != NULL; p = next(p))
|
||||
#define for_2list(p1, p2, l1, l2) for \
|
||||
(p1 = (l1? next(l1): NULL), p2 = (l2? next(l2): NULL); \
|
||||
p1 != l1 && p1 != NULL && p2 != l2 && p2 != NULL; \
|
||||
p1 = next(p1), p2 = next(p2))
|
||||
#define end_list(p, l) (p == l || p == NULL)
|
||||
|
||||
#define makelist(d) _makelist((Cast) d)
|
||||
#define addhead(l, d) _addhead(l, (Cast) d)
|
||||
#define addtail(l, d) _addtail(l, (Cast) d)
|
||||
#define insert_before(l, w, d) _insert_before(l, w, (Cast) d)
|
||||
#define insert_after(l, w, d) _insert_after(l, w, (Cast) d)
|
||||
|
||||
extern List *makelist0();
|
||||
extern List *_makelist();
|
||||
extern List *_addhead();
|
||||
extern List *_addtail();
|
||||
extern List *addlist();
|
||||
extern delete();
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
** Common macros for Cake
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
#define checkpatlen(p) if (strlen(p) > MAXPATSIZE) \
|
||||
printf("Pattern %s too long\n", p), exit_cake(FALSE)
|
||||
#define cdebug if (cakedebug) printf
|
||||
|
||||
#ifndef CAKEDEBUG
|
||||
#define put_trail(func, event)
|
||||
#define get_trail(fp)
|
||||
#endif
|
||||
|
||||
/* Flag handling */
|
||||
|
||||
#define on_node(n, f) ((n)->n_flag & (f))
|
||||
#define off_node(n, f) (!((n)->n_flag & (f)))
|
||||
#define set_node(n, f) (n)->n_flag |= (f)
|
||||
#define reset_node(n, f) (n)->n_flag &= ~(f)
|
||||
|
||||
#define on_pat(p, f) ((p)->p_flag & (f))
|
||||
#define off_pat(p, f) (!((p)->p_flag & (f)))
|
||||
#define set_pat(p, f) (p)->p_flag |= (f)
|
||||
#define reset_pat(p, f) (p)->p_flag &= ~(f)
|
||||
|
||||
#define on_act(a, f) ((a)->a_flag & (f))
|
||||
#define off_act(a, f) (!((a)->a_flag & (f)))
|
||||
#define set_act(a, f) (a)->a_flag |= (f)
|
||||
#define reset_act(a, f) (a)->a_flag &= ~(f)
|
||||
|
||||
#define is_ok(n) ((n)->n_kind == n_OK)
|
||||
#define is_cando(n) ((n)->n_kind == n_CANDO)
|
||||
#define is_noway(n) ((n)->n_kind == n_NOWAY)
|
||||
-537
@@ -1,537 +0,0 @@
|
||||
/*
|
||||
** Cake main file.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
typedef struct passwd Pwent;
|
||||
typedef struct stat Stat;
|
||||
|
||||
int Gflag = FALSE;
|
||||
int Lflag = FALSE;
|
||||
int Rflag = FALSE;
|
||||
int Xflag = FALSE;
|
||||
int Zflag = FALSE;
|
||||
int bflag = FALSE;
|
||||
int cflag = FALSE;
|
||||
int dflag = FALSE;
|
||||
int gflag = FALSE;
|
||||
int iflag = FALSE;
|
||||
int kflag = TRUE;
|
||||
int nflag = FALSE;
|
||||
int qflag = FALSE;
|
||||
int rflag = FALSE;
|
||||
int sflag = FALSE;
|
||||
int tflag = FALSE;
|
||||
int vflag = FALSE;
|
||||
int wflag = FALSE;
|
||||
int xflag = FALSE;
|
||||
int zflag = FALSE;
|
||||
|
||||
char *cakefile = NULL;
|
||||
char *shellfile[2] = { SYSTEM_CMD, SCRIPT_CMD };
|
||||
char *metachars = METACHARS;
|
||||
int maxprocs = 1;
|
||||
List *active_procs;
|
||||
char scratchbuf[128];
|
||||
|
||||
int cakedebug = FALSE;
|
||||
int entrydebug = FALSE;
|
||||
int patdebug = FALSE;
|
||||
int lexdebug = FALSE;
|
||||
|
||||
char cakeflagbuf[MAXSIZE];
|
||||
char *cppargv[MAXARGS];
|
||||
int cppargc = 0;
|
||||
|
||||
extern int yydebug;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
extern cake_abort(), cake_finish();
|
||||
extern int parse_args(), process_args();
|
||||
extern Node *chase();
|
||||
extern char *getenv();
|
||||
extern char *dir_setup();
|
||||
extern Pwent *getpwuid();
|
||||
extern int geteuid();
|
||||
extern FILE *cake_popen();
|
||||
extern FILE *yyin;
|
||||
Stat statbuf;
|
||||
int envc;
|
||||
char *envv[MAXARGS];
|
||||
reg Pwent *pwent;
|
||||
reg char *envstr;
|
||||
reg int status;
|
||||
reg Node *rootnode;
|
||||
|
||||
signal(SIGINT, cake_finish);
|
||||
signal(SIGQUIT, cake_finish);
|
||||
signal(SIGILL, cake_abort);
|
||||
signal(SIGTRAP, cake_abort);
|
||||
/* signal(SIGIOT, cake_abort); /* BRL */
|
||||
signal(SIGEMT, cake_abort);
|
||||
signal(SIGFPE, cake_abort);
|
||||
signal(SIGBUS, cake_abort);
|
||||
signal(SIGSEGV, cake_abort);
|
||||
signal(SIGSYS, cake_abort);
|
||||
signal(SIGPIPE, cake_abort);
|
||||
signal(SIGALRM, cake_abort);
|
||||
|
||||
yydebug = FALSE;
|
||||
active_procs = makelist0();
|
||||
|
||||
if (rindex(argv[0], 'f') != NULL
|
||||
&& streq(rindex(argv[0], 'f'), "fake"))
|
||||
cakedebug = TRUE;
|
||||
|
||||
init_sym();
|
||||
cppargv[cppargc++] = new_name(CPP);
|
||||
strcpy(cakeflagbuf, "-DCAKEFLAGS=");
|
||||
|
||||
if ((envstr = getenv("CAKE")) != NULL)
|
||||
{
|
||||
envc = parse_args(envstr, envv);
|
||||
process_args(envv, &envc, 0);
|
||||
if (envc > 0)
|
||||
fprintf(stderr, "cake: non-options in environment ignored\n");
|
||||
}
|
||||
|
||||
argv += process_args(argv, &argc, 1);
|
||||
|
||||
#if defined(CAKEDEBUG) && !defined(ATT)
|
||||
if (cakedebug || entrydebug || patdebug || lexdebug)
|
||||
setlinebuf(stdout);
|
||||
#endif
|
||||
|
||||
if (cakefile == NULL)
|
||||
{
|
||||
if (stat("cakefile", &statbuf) == 0)
|
||||
cakefile = "cakefile";
|
||||
or (stat("Cakefile", &statbuf) == 0)
|
||||
cakefile = "Cakefile";
|
||||
or (stat("recipe", &statbuf) == 0)
|
||||
cakefile = "recipe";
|
||||
or (stat("Recipe", &statbuf) == 0)
|
||||
cakefile = "Recipe";
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "cake: cannot locate a cakefile\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (gflag)
|
||||
cakefile = dir_setup(cakefile);
|
||||
|
||||
pwent = getpwuid(geteuid());
|
||||
strcpy(scratchbuf, "-I");
|
||||
strcat(scratchbuf, pwent->pw_dir);
|
||||
strcat(scratchbuf, ULIB);
|
||||
cppargv[cppargc++] = new_name(scratchbuf);
|
||||
strcpy(scratchbuf, "-I");
|
||||
strcat(scratchbuf, SLIB);
|
||||
cppargv[cppargc++] = new_name(scratchbuf);
|
||||
cppargv[cppargc++] = cakeflagbuf;
|
||||
cppargv[cppargc++] = cakefile;
|
||||
cppargv[cppargc] = NULL;
|
||||
|
||||
if (cakedebug)
|
||||
{
|
||||
reg int i;
|
||||
|
||||
for (i = 0; i < cppargc; i++)
|
||||
printf("%s\n", cppargv[i]);
|
||||
}
|
||||
|
||||
if ((yyin = cake_popen(cppargv, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "cake: cannot open cpp filter\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (Zflag)
|
||||
{
|
||||
reg int c;
|
||||
|
||||
while ((c = getc(yyin)) != EOF)
|
||||
putchar(c);
|
||||
|
||||
cake_pclose(yyin);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
yyinit();
|
||||
init_entry();
|
||||
if (yyparse())
|
||||
{
|
||||
fprintf(stderr, "cake: cannot parse %s\n", cakefile);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
shell_setup(shellfile[0], 0);
|
||||
shell_setup(shellfile[1], 1);
|
||||
meta_setup(metachars);
|
||||
|
||||
cake_pclose(yyin);
|
||||
dir_start();
|
||||
prep_entries();
|
||||
final_entry(argc, argv);
|
||||
|
||||
rootnode = chase(CHASEROOT, 0, (Entry *) NULL);
|
||||
|
||||
if (! qflag)
|
||||
execute(rootnode);
|
||||
|
||||
dir_finish();
|
||||
cleanup();
|
||||
#ifdef STATS_FILE
|
||||
statistics();
|
||||
#endif
|
||||
|
||||
status = (off_node(rootnode, nf_ERR) && is_ok(rootnode))? 0: 1;
|
||||
cdebug("exit status %d\n", status);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int
|
||||
process_args(vector, count, base)
|
||||
reg char **vector;
|
||||
reg int *count;
|
||||
reg int base;
|
||||
{
|
||||
reg int i, j;
|
||||
|
||||
j = 0;
|
||||
cdebug("process args:");
|
||||
while (*count > base && vector[base][0] == '-')
|
||||
{
|
||||
putflag(base, vector[base]);
|
||||
|
||||
for (i = 1; vector[base][i] != '\0'; i++)
|
||||
{
|
||||
switch (vector[base][i])
|
||||
{
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
when 'C': cdebug(" -C");
|
||||
cakedebug = ! cakedebug;
|
||||
|
||||
when 'E': cdebug(" -E");
|
||||
entrydebug = ! entrydebug;
|
||||
|
||||
when 'P': cdebug(" -P");
|
||||
patdebug = ! patdebug;
|
||||
|
||||
when 'W': cdebug(" -W");
|
||||
lexdebug = TRUE;
|
||||
|
||||
when 'Y': cdebug(" -Y");
|
||||
yydebug = TRUE;
|
||||
#endif
|
||||
when 'G': cdebug(" -G");
|
||||
Gflag = TRUE;
|
||||
|
||||
when 'L': cdebug(" -L");
|
||||
Lflag = TRUE;
|
||||
|
||||
when 'R': cdebug(" -R");
|
||||
Rflag = TRUE;
|
||||
|
||||
when 'X': cdebug(" -X");
|
||||
Xflag = TRUE;
|
||||
|
||||
when 'Z': cdebug(" -Z");
|
||||
Zflag = TRUE;
|
||||
|
||||
when 'a': cdebug(" -a");
|
||||
kflag = FALSE;
|
||||
|
||||
when 'b': cdebug(" -b");
|
||||
bflag = TRUE;
|
||||
|
||||
when 'c': cdebug(" -c");
|
||||
cflag = TRUE;
|
||||
|
||||
when 'd': cdebug(" -d");
|
||||
dflag = TRUE;
|
||||
|
||||
when 'g': cdebug(" -g");
|
||||
gflag = TRUE;
|
||||
|
||||
when 'i': cdebug(" -i");
|
||||
iflag = TRUE;
|
||||
|
||||
when 'k': cdebug(" -k");
|
||||
kflag = TRUE;
|
||||
|
||||
when 'n': cdebug(" -n");
|
||||
nflag = TRUE;
|
||||
tflag = FALSE;
|
||||
qflag = FALSE;
|
||||
|
||||
when 'q': cdebug(" -q");
|
||||
qflag = TRUE;
|
||||
nflag = FALSE;
|
||||
tflag = FALSE;
|
||||
|
||||
when 'r': cdebug(" -r");
|
||||
rflag = TRUE;
|
||||
|
||||
when 's': cdebug(" -s");
|
||||
sflag = TRUE;
|
||||
|
||||
when 't': cdebug(" -t");
|
||||
tflag = TRUE;
|
||||
nflag = FALSE;
|
||||
qflag = FALSE;
|
||||
|
||||
when 'v': cdebug(" -v");
|
||||
vflag = TRUE;
|
||||
|
||||
when 'w': cdebug(" -w");
|
||||
wflag = TRUE;
|
||||
|
||||
when 'x': cdebug(" -x");
|
||||
xflag = TRUE;
|
||||
|
||||
when 'z': cdebug(" -z");
|
||||
zflag = TRUE;
|
||||
|
||||
when 'D':
|
||||
case 'I':
|
||||
case 'U': if (i != 1)
|
||||
usage();
|
||||
|
||||
cdebug(" %s", vector[base]);
|
||||
cppargv[cppargc++] = new_name(vector[base]);
|
||||
goto nextword;
|
||||
|
||||
when 'N': putflag(base, vector[base+1]);
|
||||
sscanf(vector[base+1], "%d", &maxprocs);
|
||||
if (vector[base][i+1] != '\0')
|
||||
usage();
|
||||
|
||||
cdebug(" -N %d", maxprocs);
|
||||
(*count)--;
|
||||
vector++, j++;
|
||||
goto nextword;
|
||||
|
||||
when 'S': putflag(base, vector[base+1]);
|
||||
if (vector[base][i+1] == '1')
|
||||
shellfile[0] = new_name(vector[base+1]);
|
||||
or (vector[base][i+1] == '2')
|
||||
shellfile[1] = new_name(vector[base+1]);
|
||||
else
|
||||
usage();
|
||||
|
||||
if (vector[base][i+2] != '\0')
|
||||
usage();
|
||||
|
||||
cdebug(" -S%c %s", vector[base][i+1], vector[base+1]);
|
||||
(*count)--;
|
||||
vector++, j++;
|
||||
goto nextword;
|
||||
|
||||
when 'T': putflag(base, vector[base+1]);
|
||||
metachars = new_name(vector[base+1]);
|
||||
if (vector[base][i+1] != '\0')
|
||||
usage();
|
||||
|
||||
cdebug(" -T %s", metachars);
|
||||
(*count)--;
|
||||
vector++, j++;
|
||||
goto nextword;
|
||||
|
||||
when 'f': putflag(base, vector[base+1]);
|
||||
cakefile = new_name(vector[base+1]);
|
||||
if (vector[base][i+1] != '\0')
|
||||
usage();
|
||||
|
||||
cdebug(" -f %s", cakefile);
|
||||
(*count)--;
|
||||
vector++, j++;
|
||||
goto nextword;
|
||||
|
||||
otherwise: usage();
|
||||
}
|
||||
}
|
||||
|
||||
nextword:
|
||||
(*count)--;
|
||||
vector++, j++;
|
||||
}
|
||||
|
||||
cdebug(" \nreturn %d\n", j); /* BRL MOD */
|
||||
return j;
|
||||
}
|
||||
|
||||
/*
|
||||
** Put a flag into the CAKEFLAGS definition.
|
||||
*/
|
||||
|
||||
putflag(base, flag)
|
||||
reg int base;
|
||||
reg char *flag;
|
||||
{
|
||||
if (base == 1)
|
||||
{
|
||||
strcat(cakeflagbuf, " ");
|
||||
strcat(cakeflagbuf, flag);
|
||||
if (strlen(cakeflagbuf) >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake: CAKEFLAGS too long\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Tell the unfortunate user how to use cake.
|
||||
*/
|
||||
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "Usage: cake [-abcdgiknqrstvwxzGLRXZ] [-ffile]\n");
|
||||
fprintf(stderr, " [-Ddefn] [-Idir] [-Uname] [-S shell] [-T metachars] [file ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit_cake(needtrail)
|
||||
reg int needtrail;
|
||||
{
|
||||
if (cakedebug && needtrail)
|
||||
get_trail(stdout);
|
||||
else
|
||||
dir_finish();
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Handle bus errors and segmentation violations.
|
||||
*/
|
||||
|
||||
cake_abort()
|
||||
{
|
||||
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
|
||||
printf("Abort on signal\n");
|
||||
if (cakedebug)
|
||||
get_trail(stdout);
|
||||
|
||||
signal(SIGQUIT, SIG_DFL);
|
||||
kill(getpid(), SIGQUIT);
|
||||
}
|
||||
|
||||
/*
|
||||
** Handle user interrupts.
|
||||
*/
|
||||
|
||||
cake_finish()
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Proc *proc;
|
||||
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
|
||||
printf("*** Interrupt\n");
|
||||
fflush(stdout);
|
||||
for_list (ptr, active_procs)
|
||||
{
|
||||
proc = (Proc *) ldata(ptr);
|
||||
if (proc->pr_node != NULL)
|
||||
cake_error(proc->pr_node);
|
||||
}
|
||||
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
#ifdef STATS_FILE
|
||||
#ifdef ATT
|
||||
#include <sys/times.h>
|
||||
|
||||
typedef struct tms Tms;
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
typedef struct rusage Rusage;
|
||||
#endif
|
||||
|
||||
statistics()
|
||||
{
|
||||
extern char *getlogin();
|
||||
extern getpw();
|
||||
extern int out_tried, out_found;
|
||||
extern int stat_tried, stat_found;
|
||||
FILE *sfp;
|
||||
|
||||
if ((sfp = fopen(STATS_FILE, "a")) != NULL)
|
||||
{
|
||||
#ifdef ATT
|
||||
Tms tbuf;
|
||||
#else
|
||||
Rusage s, c;
|
||||
#endif
|
||||
long su, ss, cu, cs;
|
||||
char *usr;
|
||||
|
||||
if ((usr = getlogin()) == NULL)
|
||||
{
|
||||
char buf[256];
|
||||
char *usr_end;
|
||||
|
||||
if (getpw(getuid(), buf) != 0)
|
||||
usr = "NULL";
|
||||
else
|
||||
{
|
||||
usr = buf;
|
||||
if ((usr_end = index(usr, ':')) != NULL)
|
||||
*usr_end = '\0';
|
||||
else
|
||||
usr = "NULL";
|
||||
}
|
||||
|
||||
usr = new_name(usr);
|
||||
}
|
||||
|
||||
#ifdef ATT
|
||||
if (times(&tbuf) == -1)
|
||||
{
|
||||
fclose(sfp);
|
||||
return;
|
||||
}
|
||||
|
||||
su = tbuf.tms_utime*100/TIMERES;
|
||||
ss = tbuf.tms_stime*100/TIMERES;
|
||||
cu = tbuf.tms_cutime*100/TIMERES;
|
||||
cs = tbuf.tms_cstime*100/TIMERES;
|
||||
#else
|
||||
getrusage(RUSAGE_SELF, &s);
|
||||
getrusage(RUSAGE_CHILDREN, &c);
|
||||
|
||||
su = s.ru_utime.tv_sec*100 + s.ru_utime.tv_usec/10000;
|
||||
ss = s.ru_stime.tv_sec*100 + s.ru_stime.tv_usec/10000;
|
||||
cu = c.ru_utime.tv_sec*100 + c.ru_utime.tv_usec/10000;
|
||||
cs = c.ru_stime.tv_sec*100 + c.ru_stime.tv_usec/10000;
|
||||
#endif
|
||||
fprintf(sfp, "%s %ld %ld %ld %ld ", usr, su, ss, cu, cs);
|
||||
fprintf(sfp, "%d %d %d %d %d\n", sbrk(0),
|
||||
out_tried, out_found, stat_tried, stat_found);
|
||||
|
||||
fclose(sfp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
-200
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
** Module to make Cake data structures.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
Node *
|
||||
make_node(name)
|
||||
reg char *name;
|
||||
{
|
||||
reg Node *node;
|
||||
|
||||
node = make(Node);
|
||||
node->n_name = name;
|
||||
|
||||
if (name == NULL)
|
||||
return node;
|
||||
|
||||
node->n_kind = n_NOWAY; /* not yet */
|
||||
node->n_flag = 0;
|
||||
node->n_old = makelist0();
|
||||
node->n_when = NULL;
|
||||
node->n_act = NULL;
|
||||
node->n_new = makelist(node);
|
||||
#if 0 /* N must be 1 for the time being */
|
||||
node->n_pid = 0;
|
||||
node->n_file = NULL;
|
||||
#endif
|
||||
node_stat(node);
|
||||
node->n_utime = 0;
|
||||
node->n_stime = node->n_rtime;
|
||||
node->n_badguys = NULL;
|
||||
node->n_msg = NULL;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
Entry *
|
||||
make_dep(new, old, cond, file, colon)
|
||||
reg List *new; /* of Pat */
|
||||
reg List *old; /* of Pat */
|
||||
reg Test *cond;
|
||||
reg char *file;
|
||||
reg char *colon;
|
||||
{
|
||||
reg Entry *entry;
|
||||
|
||||
entry = make(Entry);
|
||||
entry->e_new = new;
|
||||
entry->e_old = old;
|
||||
entry->e_cond = cond;
|
||||
entry->e_file = file;
|
||||
entry->e_dblc = streq(colon, "::");
|
||||
entry->e_when = makelist0();
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_mm(name)
|
||||
reg Pat *name;
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = t_MATCH;
|
||||
test->t_pat = name;
|
||||
test->t_list = makelist0();
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_m(name, varpat, pattern)
|
||||
reg Pat *name;
|
||||
reg Pat *varpat;
|
||||
reg Pat *pattern;
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = t_MATCH;
|
||||
test->t_pat = name;
|
||||
test->t_list = makelist0();
|
||||
|
||||
if (varpat == NULL)
|
||||
addtail(test->t_list, make_pat("-vX", FALSE, 0));
|
||||
else
|
||||
addtail(test->t_list, varpat); /* no assignment */
|
||||
|
||||
addtail(test->t_list, pattern); /* no assignment */
|
||||
return test;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_c(cmd)
|
||||
reg char *cmd;
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = t_CMD;
|
||||
test->t_cmd = cmd;
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_s(tkind, pat)
|
||||
reg T_kind tkind;
|
||||
reg Pat *pat;
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = tkind;
|
||||
test->t_pat = pat;
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_l(pat, list)
|
||||
reg Pat *pat;
|
||||
reg List *list; /* of Pat */
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = t_LIST;
|
||||
test->t_pat = pat;
|
||||
test->t_list = list;
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_b(tkind, left, right)
|
||||
reg T_kind tkind;
|
||||
reg Test *left;
|
||||
reg Test *right;
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = tkind;
|
||||
test->t_left = left;
|
||||
test->t_right = right;
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Test *
|
||||
make_test_u(tkind, left)
|
||||
reg T_kind tkind;
|
||||
reg Test *left;
|
||||
{
|
||||
reg Test *test;
|
||||
|
||||
test = make(Test);
|
||||
test->t_kind = tkind;
|
||||
test->t_left = left;
|
||||
test->t_right = (Test *) NULL;
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Pat *
|
||||
make_pat(text, iscmd, flags)
|
||||
reg char *text;
|
||||
reg bool iscmd;
|
||||
reg int flags;
|
||||
{
|
||||
reg Pat *pat;
|
||||
|
||||
pat = make(Pat);
|
||||
pat->p_str = text;
|
||||
pat->p_cmd = iscmd;
|
||||
pat->p_flag = flags;
|
||||
|
||||
checkpatlen(text);
|
||||
return pat;
|
||||
}
|
||||
|
||||
Act *
|
||||
make_act(str, flag)
|
||||
reg char *str;
|
||||
reg int flag;
|
||||
{
|
||||
reg Act *act;
|
||||
|
||||
act = make(Act);
|
||||
act->a_str = str;
|
||||
act->a_flag = flag;
|
||||
|
||||
return act;
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
** Memory management module.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** Allocate space if possible. In the future it may record
|
||||
** all pointers returned, so that old can do some checks.
|
||||
*/
|
||||
|
||||
Cast
|
||||
newmem(size)
|
||||
int size;
|
||||
{
|
||||
reg char *space;
|
||||
|
||||
if ((space = malloc((unsigned) size)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "cake system error: no more malloc\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
#ifdef EXTRACHECK
|
||||
if (((int) space & 03) != 0)
|
||||
{
|
||||
fprintf(stderr, "cake system error: malloc not aligned\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (Cast) space;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return some storage to the free list. This storage must
|
||||
** have been obtained from new and malloc.
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
oldmem(ptr)
|
||||
Cast ptr;
|
||||
{
|
||||
#ifdef MEMUSED
|
||||
free((char *) ptr);
|
||||
#endif
|
||||
}
|
||||
-352
@@ -1,352 +0,0 @@
|
||||
/*
|
||||
** Module to manipulate Cake patterns.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
** This function serves as an interface to the rest of the system
|
||||
** for domatch, looking after its environment.
|
||||
*/
|
||||
|
||||
bool
|
||||
match(env, str, pat)
|
||||
Env env;
|
||||
reg char *str;
|
||||
reg Pat *pat;
|
||||
{
|
||||
extern bool domatch();
|
||||
reg bool result;
|
||||
reg int i;
|
||||
reg char *s, *p;
|
||||
|
||||
if (patdebug)
|
||||
printf("Match %s vs %s\n", str, pat->p_str);
|
||||
|
||||
if (pat->p_cmd)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: undereferenced pattern %s in match\n",
|
||||
pat->p_str);
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
|
||||
if (streq(str, CHASEROOT))
|
||||
result = streq(pat->p_str, CHASEROOT);
|
||||
else
|
||||
{
|
||||
result = TRUE; /* assume so for the moment */
|
||||
p = pat->p_str+strlen(pat->p_str)-1;
|
||||
if (*p != '%' && !isdigit(*p)) /* not part of a var */
|
||||
{
|
||||
s = str+strlen(str)-1;
|
||||
if (*s != *p) /* last chars differ */
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
if (result) /* if last-char test inconclusive */
|
||||
{
|
||||
for (i = 0; i < MAXVAR; i++)
|
||||
env[i].v_bound = FALSE;
|
||||
|
||||
result = domatch(env, str, pat->p_str);
|
||||
}
|
||||
}
|
||||
|
||||
if (patdebug)
|
||||
{
|
||||
if (result == FALSE)
|
||||
printf("Match failed\n");
|
||||
else
|
||||
{
|
||||
printf("Match succeeded\n");
|
||||
for (i = 0; i < MAXVAR; i++)
|
||||
if (env[i].v_bound)
|
||||
printf("X%d: %s\n", i, env[i].v_val);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
** Match a string against a pattern.
|
||||
** The pattern is expected to have been dereferenced.
|
||||
** To handle nondeterminism, a brute force recursion approach
|
||||
** is taken.
|
||||
*/
|
||||
|
||||
bool
|
||||
domatch(env, str, patstr)
|
||||
Env env;
|
||||
reg char *str;
|
||||
reg char *patstr;
|
||||
{
|
||||
char buf[MAXPATSIZE];
|
||||
reg char *follow;
|
||||
reg char *s, *t;
|
||||
reg int varno;
|
||||
reg int i;
|
||||
reg bool more;
|
||||
|
||||
put_trail("domatch", "start");
|
||||
if (patstr[0] == '%')
|
||||
{
|
||||
if (isdigit(patstr[1]))
|
||||
{
|
||||
varno = patstr[1] - '0';
|
||||
follow = patstr + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
varno = NOVAR;
|
||||
follow = patstr + 1;
|
||||
}
|
||||
|
||||
if (env[varno].v_bound)
|
||||
{
|
||||
/* lifetime of buf is local */
|
||||
strcpy(buf, env[varno].v_val);
|
||||
strcat(buf, follow);
|
||||
checkpatlen(buf);
|
||||
put_trail("domatch", "recurse");
|
||||
return domatch(env, str, buf);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
buf[0] = '\0';
|
||||
env[varno].v_bound = TRUE;
|
||||
env[varno].v_val = buf;
|
||||
|
||||
/* keep invariant: buf = tentative value of var */
|
||||
/* the value of a variable may never contain a % */
|
||||
/* must consider *s == \0, but do not overshoot */
|
||||
for (s = str, more = TRUE; more && *s != '%'; s++)
|
||||
{
|
||||
if (patdebug)
|
||||
printf("trying X%d = '%s'\n", varno, buf);
|
||||
|
||||
if (domatch(env, s, follow))
|
||||
{
|
||||
checkpatlen(buf);
|
||||
env[varno].v_val = new_name(buf);
|
||||
/* lifetime of buf is now global */
|
||||
put_trail("domatch", "finish");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* maintain invariant */
|
||||
buf[i++] = *s;
|
||||
buf[i] = '\0';
|
||||
|
||||
more = (*s != '\0');
|
||||
}
|
||||
|
||||
/* no luck, match failed */
|
||||
env[varno].v_bound = FALSE;
|
||||
put_trail("domatch", "finish");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* here we have something other than a variable first off */
|
||||
for (s = str, t = patstr; *t != '\0' && *t != '%'; s++, t++)
|
||||
{
|
||||
if (*t == '\\')
|
||||
t++; /* the new *t is not checked for % */
|
||||
|
||||
if (*s != *t)
|
||||
{
|
||||
put_trail("domatch", "finish");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* see if we have come to the end of the pattern */
|
||||
if (*t == '\0')
|
||||
{
|
||||
put_trail("domatch", "finish");
|
||||
return *s == '\0';
|
||||
}
|
||||
|
||||
/* if not, recurse on the next variable */
|
||||
put_trail("domatch", "recurse");
|
||||
return domatch(env, s, t);
|
||||
}
|
||||
|
||||
/*
|
||||
** Ground the argument string, i.e. replace all occurrences
|
||||
** of variables in it. It is fatal error for the string to
|
||||
** contain a variable which has no value.
|
||||
*/
|
||||
|
||||
char *
|
||||
ground(env, str)
|
||||
Env env;
|
||||
reg char *str;
|
||||
{
|
||||
reg char *s, *t;
|
||||
reg int i, var;
|
||||
char buf[MAXSIZE];
|
||||
|
||||
put_trail("ground", "start");
|
||||
i = 0;
|
||||
for (s = str; *s != '\0'; s++)
|
||||
{
|
||||
if (*s == '%')
|
||||
{
|
||||
if (isdigit(s[1]))
|
||||
var = *++s - '0';
|
||||
else
|
||||
var = NOVAR;
|
||||
|
||||
if (! env[var].v_bound)
|
||||
{
|
||||
if (var == NOVAR)
|
||||
fprintf(stderr, "cake: %s is undefined in %s\n", "%", str);
|
||||
else
|
||||
fprintf(stderr, "cake: %s%1d is undefined in %s\n", "%", var, str);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
for (t = env[var].v_val; *t != '\0'; t++)
|
||||
buf[i++] = *t;
|
||||
}
|
||||
or (*s == '\\')
|
||||
{
|
||||
if (s[1] != '\0')
|
||||
buf[i++] = *++s;
|
||||
}
|
||||
else
|
||||
buf[i++] = *s;
|
||||
}
|
||||
|
||||
buf[i] = '\0';
|
||||
if (i >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: pattern buffer overflow for %s\n", buf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
put_trail("ground", "new_name finish");
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
** See if the argument contains any variebles.
|
||||
*/
|
||||
|
||||
bool
|
||||
hasvars(str)
|
||||
reg char *str;
|
||||
{
|
||||
reg char *s;
|
||||
|
||||
for (s = str; *s != '\0'; s++)
|
||||
{
|
||||
if (*s == '%')
|
||||
return TRUE;
|
||||
or (*s == '\\')
|
||||
{
|
||||
if (s[1] != '\0')
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
** Dereference the pattern; i.e. if it a command pattern
|
||||
** replace it with the output of the command. It is the task
|
||||
** of the caller to break this up if necessary.
|
||||
** Note that the pattern will never have to be dereferenced again.
|
||||
**
|
||||
** The second arg says whether the pattern is to be broken after
|
||||
** dereferencing: this is needed purely for debugging purposes.
|
||||
*/
|
||||
|
||||
deref(pat, broken)
|
||||
reg Pat *pat;
|
||||
reg bool broken;
|
||||
{
|
||||
extern char *expand_cmds();
|
||||
|
||||
if (! pat->p_cmd)
|
||||
return;
|
||||
|
||||
pat->p_cmd = FALSE;
|
||||
pat->p_str = expand_cmds(pat->p_str);
|
||||
|
||||
if (! broken)
|
||||
checkpatlen(pat->p_str);
|
||||
}
|
||||
|
||||
/*
|
||||
** Break the given pattern up into a (possibly empty) list
|
||||
** of smaller patterns at white space positions.
|
||||
*/
|
||||
|
||||
List *
|
||||
break_pat(pat)
|
||||
reg Pat *pat;
|
||||
{
|
||||
reg Pat *newpat;
|
||||
reg List *list;
|
||||
reg char *s;
|
||||
|
||||
put_trail("break_pat", "start");
|
||||
if (pat->p_cmd)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: trying to break command pattern %s\n", pat->p_str);
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
|
||||
list = makelist0();
|
||||
s = pat->p_str;
|
||||
while (*s != '\0')
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg int i;
|
||||
|
||||
for (; *s != '\0' && isspace(*s); s++)
|
||||
;
|
||||
|
||||
i = 0;
|
||||
for (; *s != '\0' && !isspace(*s); s++)
|
||||
buf[i++] = *s;
|
||||
|
||||
buf[i] = '\0';
|
||||
if (i > 0)
|
||||
{
|
||||
newpat = make_pat(new_name(buf), FALSE, pat->p_flag);
|
||||
addtail(list, newpat); /* no assignment */
|
||||
}
|
||||
}
|
||||
|
||||
put_trail("break_pat", "finish");
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
** Add flags to a list of patterns.
|
||||
*/
|
||||
|
||||
List *
|
||||
set_flag(patlist, flags)
|
||||
reg List *patlist;
|
||||
reg int flags;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Pat *pat;
|
||||
|
||||
for_list (ptr, patlist)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
pat->p_flag |= flags;
|
||||
}
|
||||
|
||||
return patlist;
|
||||
}
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
** Cake portability aids.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
/* too long names */
|
||||
#define cake_abort c_abort
|
||||
#define cake_error c_error
|
||||
#define cake_exec c_exec
|
||||
#define cake_finish c_finish
|
||||
#define cake_gettime c_gettime
|
||||
#define cake_pclose c_pclose
|
||||
#define cake_popen c_popen
|
||||
#define cake_remove c_remove
|
||||
#define cake_script c_script
|
||||
#define cake_system c_system
|
||||
#define cake_utimes c_utimes
|
||||
#define cake_wait c_wait
|
||||
#define chase chs
|
||||
#define chase_node chs_node
|
||||
#define cppargc cppcarg
|
||||
#define cppargv cppvarg
|
||||
#define deref drf
|
||||
#define deref_entry drf_entry
|
||||
#define dir_finish dr_finish
|
||||
#define dir_setup dr_setup
|
||||
#define dir_start dr_start
|
||||
#define entry_anay en_nay
|
||||
#define entry_ayea en_yea
|
||||
#define expand_cmds ex_cmds
|
||||
#define find_path fd_path
|
||||
#define find_process fd_proc
|
||||
#define found_incl fnd_incl
|
||||
#define found_main fnd_main
|
||||
#define get_allnodes g_allnodes
|
||||
#define get_cmd_result gc_result
|
||||
#define get_cmd_status gc_status
|
||||
#define get_newname g_newname
|
||||
#define get_output g_output
|
||||
#define get_savename g_savename
|
||||
#define get_utime g_utime
|
||||
#define get_youngest g_youngest
|
||||
#define goal_stackp gs_p
|
||||
#define ground gr
|
||||
#define ground_entry gr_entry
|
||||
#define ground_test gr_test
|
||||
#define init_chase i_chase
|
||||
#define init_entry i_entry
|
||||
#define init_sym i_sym
|
||||
#define make_act m_act
|
||||
#define make_cmd m_cmd
|
||||
#define make_dep m_dep
|
||||
#define make_node m_node
|
||||
#define make_pat m_pat
|
||||
#define make_test_b m_btest
|
||||
#define make_test_c m_ctest
|
||||
#define make_test_l m_ltest
|
||||
#define make_test_m m_mtest
|
||||
#define make_test_mm m_mmtest
|
||||
#define make_test_s m_stest
|
||||
#define make_test_u m_utest
|
||||
#define makelist0 m_0list
|
||||
#define miss_anay ms_nay
|
||||
#define miss_ayea ms_yea
|
||||
#define mutex_lock mx_lock
|
||||
#define mutex_unlock mx_unlock
|
||||
#define name_equal nm_equal
|
||||
#define name_key nm_key
|
||||
#define new_cmd nw_cmd
|
||||
#define new_name nw_name
|
||||
#define node_resetstat nd_resetstat
|
||||
#define node_setstat nd_setstat
|
||||
#define node_stat nd_stats
|
||||
#define picked_time pck_time
|
||||
#define prep_act pp_act
|
||||
#define prep_entries pp_entries
|
||||
#define prep_script pp_script
|
||||
#define print_act pr_act
|
||||
#define print_entry pr_entry
|
||||
#define print_node pr_node
|
||||
#define print_pat pr_pat
|
||||
#define print_test pr_test
|
||||
#define print_time pr_time
|
||||
#define script_filename scr_fn
|
||||
#define set_buddies st_buddies
|
||||
#define set_flag st_flag
|
||||
#define shell_cmd sh_cmd
|
||||
#define shell_opt sh_opt
|
||||
#define shell_path sh_path
|
||||
#define signalint sg_int
|
||||
#define signalquit sg_quit
|
||||
#define spawn_finish sp_finish
|
||||
#define spawn_start sp_start
|
||||
#define stat_tried st_tried
|
||||
#define str_aflag s_aflag
|
||||
#define str_nkind s_nkind
|
||||
#define str_pflag s_pflag
|
||||
#define warn_equal w_equal
|
||||
#define warn_key w_key
|
||||
|
||||
/* case sensitive variable names */
|
||||
#define Gflag ggflag
|
||||
#define Lflag llflag
|
||||
#define Rflag rrflag
|
||||
#define Xflag xxflag
|
||||
-303
@@ -1,303 +0,0 @@
|
||||
/*
|
||||
** Printout routines for Cake data structures.
|
||||
*/
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
char *
|
||||
str_pflag(flag)
|
||||
reg int flag;
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
strcpy(buf, "[");
|
||||
if (flag & nf_NONVOL)
|
||||
strcat(buf, "nonvol ");
|
||||
if (flag & nf_PRECIOUS)
|
||||
strcat(buf, "precious ");
|
||||
if (flag & nf_PSEUDO)
|
||||
strcat(buf, "pseudo ");
|
||||
if (flag & nf_REDUNDANT)
|
||||
strcat(buf, "redundant ");
|
||||
if (flag & nf_WHEN)
|
||||
strcat(buf, "when ");
|
||||
if (flag & nf_DEPNONVOL)
|
||||
strcat(buf, "depnonvol ");
|
||||
if (flag & nf_NODELETE)
|
||||
strcat(buf, "nodelete ");
|
||||
if (flag & nf_NEWFILE)
|
||||
strcat(buf, "newfile ");
|
||||
if (flag & nf_EXIST)
|
||||
strcat(buf, "exist ");
|
||||
if (flag & nf_BUSY)
|
||||
strcat(buf, "busy ");
|
||||
if (flag & nf_ERR)
|
||||
strcat(buf, "err ");
|
||||
if (flag & nf_TRACED)
|
||||
strcat(buf, "traced ");
|
||||
if (flag & nf_WARNED)
|
||||
strcat(buf, "warned ");
|
||||
if (flag & nf_ORIG)
|
||||
strcat(buf, "orig ");
|
||||
|
||||
if (strlen(buf) > 1)
|
||||
buf[strlen(buf)-1] = '\0';
|
||||
|
||||
strcat(buf, "]");
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
char *
|
||||
str_aflag(flag)
|
||||
reg int flag;
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
strcpy(buf, "[");
|
||||
if (flag & af_SILENT)
|
||||
strcat(buf, "silent ");
|
||||
if (flag & af_IGNORE)
|
||||
strcat(buf, "ignore ");
|
||||
if (flag & af_MINUSN)
|
||||
strcat(buf, "minusn ");
|
||||
if (flag & af_SYSTEM)
|
||||
strcat(buf, "system ");
|
||||
if (flag & af_SCRIPT)
|
||||
strcat(buf, "script ");
|
||||
|
||||
if (strlen(buf) > 1)
|
||||
buf[strlen(buf)-1] = '\0';
|
||||
|
||||
strcat(buf, "]");
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
print_pat(pat)
|
||||
reg Pat *pat;
|
||||
{
|
||||
if (pat->p_cmd)
|
||||
printf("`%s`", pat->p_str);
|
||||
else
|
||||
printf("%s", pat->p_str);
|
||||
|
||||
printf(str_pflag(pat->p_flag));
|
||||
}
|
||||
|
||||
print_act(act)
|
||||
reg Act *act;
|
||||
{
|
||||
printf(str_aflag(act->a_flag));
|
||||
printf("%s", act->a_str);
|
||||
}
|
||||
|
||||
print_test(test)
|
||||
reg Test *test;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg char *pre;
|
||||
reg Pat *pat;
|
||||
|
||||
if (test == NULL)
|
||||
{
|
||||
printf("null");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (test->t_kind)
|
||||
{
|
||||
|
||||
when t_TRUE: printf("true");
|
||||
when t_FALSE: printf("false");
|
||||
|
||||
when t_AND: print_test(test->t_left);
|
||||
printf(" and ");
|
||||
print_test(test->t_right);
|
||||
|
||||
when t_OR: print_test(test->t_left);
|
||||
printf(" or ");
|
||||
print_test(test->t_right);
|
||||
|
||||
when t_NOT: printf("not ");
|
||||
print_test(test->t_left);
|
||||
|
||||
when t_CMD: printf("cmd `%s`", test->t_cmd);
|
||||
|
||||
when t_MATCH: printf("match ");
|
||||
print_pat(test->t_pat);
|
||||
printf(" against");
|
||||
printf(" (");
|
||||
print_pat((Pat *) first(test->t_list));
|
||||
printf(") ");
|
||||
print_pat((Pat *) last(test->t_list));
|
||||
|
||||
when t_LIST: printf("list ");
|
||||
print_pat(test->t_pat);
|
||||
|
||||
printf(" in (");
|
||||
pre = "";
|
||||
for_list (ptr, test->t_list)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
printf(pre);
|
||||
print_pat(pat);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf(")");
|
||||
|
||||
when t_EXIST: printf("exist ");
|
||||
print_pat(test->t_pat);
|
||||
|
||||
when t_CANDO: printf("cando ");
|
||||
print_pat(test->t_pat);
|
||||
|
||||
when t_OK: printf("ok ");
|
||||
print_pat(test->t_pat);
|
||||
|
||||
otherwise: printf("Bad type kind %d in print_test\n", test->t_kind);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print_entry(entry)
|
||||
reg Entry *entry;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Pat *pat;
|
||||
reg Act *act;
|
||||
reg char *pre;
|
||||
|
||||
printf("ENTRY\nnew: ");
|
||||
pre = "";
|
||||
for_list (ptr, entry->e_new)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
printf(pre);
|
||||
print_pat(pat);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf("\nold: ");
|
||||
pre = "";
|
||||
for_list (ptr, entry->e_old)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
printf(pre);
|
||||
print_pat(pat);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf("\nwhen: ");
|
||||
pre = "";
|
||||
for_list (ptr, entry->e_when)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
printf(pre);
|
||||
print_pat(pat);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf("\ntest: ");
|
||||
print_test(entry->e_cond);
|
||||
|
||||
printf("\nactions:\n");
|
||||
for_list (ptr, entry->e_act)
|
||||
{
|
||||
act = (Act *) ldata(ptr);
|
||||
print_act(act);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
char *
|
||||
str_nkind(nkind)
|
||||
reg N_kind nkind;
|
||||
{
|
||||
switch (nkind)
|
||||
{
|
||||
when n_OK: return "ok";
|
||||
when n_NOWAY: return "noway";
|
||||
when n_CANDO: return "cando";
|
||||
}
|
||||
|
||||
return "bizarre";
|
||||
}
|
||||
|
||||
print_time(str, ntime)
|
||||
reg char *str;
|
||||
time_t ntime;
|
||||
{
|
||||
extern char *ctime();
|
||||
|
||||
printf("%s time: %d, %s", str, ntime, ctime(&ntime));
|
||||
}
|
||||
|
||||
print_node(node)
|
||||
reg Node *node;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg char *pre;
|
||||
reg Node *bnode;
|
||||
reg Act *act;
|
||||
|
||||
printf("\nNODE\n%s: kind %s flag %s\n", node->n_name,
|
||||
str_nkind(node->n_kind), str_pflag(node->n_flag));
|
||||
print_time("real", node->n_rtime);
|
||||
print_time("used", node->n_utime);
|
||||
print_time("saved", node->n_stime);
|
||||
|
||||
printf("new: ");
|
||||
pre = "";
|
||||
for_list (ptr, node->n_new)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
printf(pre);
|
||||
printf(bnode->n_name);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf("\nold: ");
|
||||
pre = "";
|
||||
for_list (ptr, node->n_old)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
printf(pre);
|
||||
printf(bnode->n_name);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf("\naction:\n");
|
||||
for_list (ptr, node->n_act)
|
||||
{
|
||||
act = (Act *) ldata(ptr);
|
||||
print_act(act);
|
||||
}
|
||||
|
||||
if (node->n_badguys != (List *) NULL)
|
||||
{
|
||||
printf("bad guys: ");
|
||||
pre = "";
|
||||
for_list (ptr, node->n_badguys)
|
||||
{
|
||||
bnode = (Node *) ldata(ptr);
|
||||
printf(pre);
|
||||
printf(bnode->n_name);
|
||||
pre = ", ";
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (node->n_msg != NULL)
|
||||
printf("msg: %s", node->n_msg);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
-493
@@ -1,493 +0,0 @@
|
||||
/*
|
||||
** Cake interface to the other processes.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
extern List *active_procs; /* of Proc */
|
||||
|
||||
/*
|
||||
** Process the given command in the manner described by the args.
|
||||
*/
|
||||
|
||||
int
|
||||
cake_proc(cmd, type, file, node, func, args)
|
||||
reg char *cmd;
|
||||
reg A_kind type;
|
||||
reg char *file;
|
||||
reg Node *node;
|
||||
reg int (*func)();
|
||||
reg List *args;
|
||||
{
|
||||
extern bool has_meta();
|
||||
extern char *strip_backslash();
|
||||
extern char *shell_path[2];
|
||||
extern char *shell_cmd[2];
|
||||
extern char *shell_opt[2];
|
||||
char *argv[MAXARGS];
|
||||
reg Proc *proc;
|
||||
reg int pid;
|
||||
reg char *script_filename;
|
||||
|
||||
cmd = strip_backslash(cmd);
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (file != NULL)
|
||||
cdebug("file is %s\n", file);
|
||||
else
|
||||
cdebug("file is NULL\n");
|
||||
#endif
|
||||
|
||||
if (type == Exec && has_meta(cmd, TRUE))
|
||||
type = System;
|
||||
|
||||
cdebug("cake_proc, type %d: %s\n", type, cmd);
|
||||
fflush(stdout);
|
||||
|
||||
if (type == Exec)
|
||||
{
|
||||
if( parse_args(cmd, argv) < 1) { /* BRL */
|
||||
printf("cake_proc: Null exec command!\n");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
}
|
||||
or (type == Script)
|
||||
{
|
||||
reg FILE *script_fp;
|
||||
|
||||
script_filename = get_newname();
|
||||
if ((script_fp = fopen(script_filename, "w")) == NULL)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, fopen %s", script_filename);
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
fprintf(script_fp, "%s", cmd);
|
||||
fclose(script_fp);
|
||||
}
|
||||
|
||||
mutex_lock();
|
||||
if ((pid = vfork()) == 0)
|
||||
{
|
||||
reg int fd;
|
||||
|
||||
#ifdef CLOSE_ALL
|
||||
for (fd = 3; fd < NOFILE; fd++)
|
||||
close(fd);
|
||||
#endif
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
if (close(1) != 0)
|
||||
{
|
||||
perror("cake system error, close stdout");
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
#ifdef ATT
|
||||
if ((fd = open(file, O_WRONLY|O_CREAT, 0600)) < 0)
|
||||
#else
|
||||
if ((fd = creat(file, 0600)) < 0) /* BRL */
|
||||
#endif
|
||||
{
|
||||
perror("cake system error, reopen stdout");
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
if (fd != 1)
|
||||
{
|
||||
fprintf(stderr, "cake system error: reopen stdout gives fd %d\n", fd);
|
||||
_exit(127);
|
||||
}
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
when Script: if (shell_opt[1] != NULL)
|
||||
execl(shell_path[1], shell_cmd[1], shell_opt[1], script_filename, 0);
|
||||
else
|
||||
execl(shell_path[1], shell_cmd[1], script_filename, 0);
|
||||
|
||||
perror("cake system error, shell script exec");
|
||||
_exit(127);
|
||||
|
||||
when System: if (shell_opt[0] != NULL)
|
||||
execl(shell_path[0], shell_cmd[0], shell_opt[0], cmd, 0);
|
||||
else
|
||||
execl(shell_path[0], shell_cmd[0], cmd, 0);
|
||||
|
||||
perror("cake system error, shell exec");
|
||||
_exit(127);
|
||||
|
||||
when Exec: execvp(argv[0], argv);
|
||||
sprintf(scratchbuf, "cake system error, %s exec", argv[0]);
|
||||
perror(scratchbuf);
|
||||
_exit(127);
|
||||
|
||||
otherwise: fprintf(stderr, "cake internal error: type = %x in cake_proc\n", type);
|
||||
_exit(127);
|
||||
}
|
||||
}
|
||||
or (pid == -1)
|
||||
{
|
||||
perror("cake system error, fork");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
proc = make(Proc);
|
||||
proc->pr_pid = pid;
|
||||
proc->pr_node = node;
|
||||
proc->pr_func = func;
|
||||
proc->pr_args = args;
|
||||
proc->pr_run = TRUE;
|
||||
addtail(active_procs, proc);
|
||||
cdebug("cake_proc pid = %d\n", pid);
|
||||
|
||||
mutex_unlock();
|
||||
if (type == Script && ! cakedebug)
|
||||
{
|
||||
cdebug("cake_proc unlink script_filename %s\n", script_filename);
|
||||
if (unlink(script_filename) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, unlink %s", script_filename);
|
||||
perror(scratchbuf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
/*
|
||||
** The cake code allows many child processes to be running
|
||||
** at any given time. Cake waits for these processes
|
||||
** when their results are required. However, there is no
|
||||
** necessary relationship between between when a process exits
|
||||
** and when its product is needed.
|
||||
**
|
||||
** The list of active processes contains all running processes
|
||||
** and all exited processes that haven't been waited for yet.
|
||||
** Cake_wait maintains this list. Whenever cake_wait gets
|
||||
** an exit report from wait, it invokes the function (if any)
|
||||
** associated with the exited process. If the exited process
|
||||
** is the one cake_wait is looking for, it returns; otherwise
|
||||
** it calls wait again and again until it finds that process.
|
||||
*/
|
||||
|
||||
Wait
|
||||
cake_wait(pid)
|
||||
reg int pid;
|
||||
{
|
||||
extern List *find_process();
|
||||
reg int exitpid;
|
||||
reg List *ptr;
|
||||
reg Proc *proc;
|
||||
Wait status;
|
||||
|
||||
mutex_lock();
|
||||
ptr = find_process(pid);
|
||||
proc = (Proc *) ldata(ptr);
|
||||
if (! proc->pr_run)
|
||||
{
|
||||
status = proc->pr_stat;
|
||||
delete(active_procs, ptr);
|
||||
mutex_unlock();
|
||||
return status;
|
||||
}
|
||||
|
||||
while ((exitpid = wait(&status)) != -1)
|
||||
{
|
||||
mutex_lock();
|
||||
ptr = find_process(exitpid);
|
||||
proc = (Proc *) ldata(ptr);
|
||||
proc->pr_run = FALSE;
|
||||
proc->pr_stat = status;
|
||||
cdebug("cake_wait pid = %d, status = %d\n", exitpid, status.w_status);
|
||||
fflush(stdout);
|
||||
|
||||
if (proc->pr_func != NULL)
|
||||
{
|
||||
cdebug("cake_wait calling function at %x\n", proc->pr_func);
|
||||
fflush(stdout);
|
||||
(*proc->pr_func)(status, proc->pr_args);
|
||||
}
|
||||
|
||||
if (exitpid == pid)
|
||||
{
|
||||
delete(active_procs, ptr);
|
||||
mutex_unlock();
|
||||
return status; /* normal return */
|
||||
}
|
||||
|
||||
mutex_unlock();
|
||||
}
|
||||
|
||||
fprintf(stderr, "cake internal error: waiting for nonactive process %s\n", pid);
|
||||
exit_cake(TRUE);
|
||||
return status; /* to shut up lint */
|
||||
}
|
||||
|
||||
/*
|
||||
** Find an active process in the active process list.
|
||||
*/
|
||||
|
||||
List *
|
||||
find_process(pid)
|
||||
reg int pid;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Proc *proc;
|
||||
reg bool found;
|
||||
|
||||
found = FALSE;
|
||||
for_list (ptr, active_procs)
|
||||
{
|
||||
proc = (Proc *) ldata(ptr);
|
||||
if (proc->pr_pid == pid)
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! found)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: cannot find active process %d\n", pid);
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
** Open a filter the cake way, with an execv instead of an execl.
|
||||
*/
|
||||
|
||||
#define READSIDE 0
|
||||
#define WRITESIDE 1
|
||||
|
||||
static int popen_pid[NOFILE];
|
||||
|
||||
FILE *
|
||||
cake_popen(argv, mode)
|
||||
reg char *argv[MAXARGS];
|
||||
reg char *mode;
|
||||
{
|
||||
int pdesc[2];
|
||||
reg int parent_end, child_end;
|
||||
reg int replaced, pid;
|
||||
reg Proc *proc;
|
||||
|
||||
if (pipe(pdesc) < 0)
|
||||
return NULL;
|
||||
|
||||
if (mode[0] == 'r')
|
||||
{
|
||||
parent_end = pdesc[READSIDE];
|
||||
child_end = pdesc[WRITESIDE];
|
||||
replaced = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent_end = pdesc[WRITESIDE];
|
||||
child_end = pdesc[READSIDE];
|
||||
replaced = 0;
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
mutex_lock();
|
||||
if ((pid = vfork()) == 0)
|
||||
{
|
||||
close(parent_end);
|
||||
close(replaced);
|
||||
if (dup(child_end) != replaced)
|
||||
_exit(127);
|
||||
|
||||
close(child_end);
|
||||
execv(argv[0], argv);
|
||||
sprintf(scratchbuf, "cake system error, %s exec", argv[0]);
|
||||
perror(scratchbuf);
|
||||
_exit(127);
|
||||
}
|
||||
or (pid == -1)
|
||||
{
|
||||
close(parent_end);
|
||||
close(child_end);
|
||||
perror("cake system error, fork");
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
proc = make(Proc);
|
||||
proc->pr_pid = pid;
|
||||
proc->pr_func = NULL;
|
||||
proc->pr_args = NULL;
|
||||
proc->pr_run = TRUE;
|
||||
addtail(active_procs, proc);
|
||||
|
||||
close(child_end);
|
||||
popen_pid[parent_end] = pid;
|
||||
mutex_unlock();
|
||||
|
||||
return fdopen(parent_end, mode);
|
||||
}
|
||||
|
||||
int
|
||||
cake_pclose(fp)
|
||||
reg FILE *fp;
|
||||
{
|
||||
Wait code;
|
||||
reg int f;
|
||||
|
||||
f = fileno(fp);
|
||||
fclose(fp);
|
||||
code = cake_wait(popen_pid[f]);
|
||||
return code.w_status;
|
||||
}
|
||||
|
||||
/*
|
||||
** Parse the given command into argv, argc.
|
||||
*/
|
||||
|
||||
int
|
||||
parse_args(cmd, vector)
|
||||
reg char *cmd;
|
||||
reg char **vector;
|
||||
{
|
||||
char buf[MAXARGSIZE];
|
||||
reg int i, count;
|
||||
reg char *s;
|
||||
reg bool instring;
|
||||
|
||||
cdebug("parse_args: ");
|
||||
|
||||
s = cmd;
|
||||
for (count = 0; *s != '\0'; count++)
|
||||
{
|
||||
while (*s != '\0' && isspace(*s))
|
||||
s++;
|
||||
|
||||
instring = FALSE;
|
||||
for (i = 0; *s != '\0' && (! isspace(*s) || instring); s++)
|
||||
{
|
||||
if (*s == '\\')
|
||||
{
|
||||
if (s[1] != '\0')
|
||||
buf[i++] = *++s;
|
||||
}
|
||||
or (*s == '"')
|
||||
instring = ! instring;
|
||||
else
|
||||
buf[i++] = *s;
|
||||
}
|
||||
|
||||
buf[i] = '\0';
|
||||
if (i >= MAXARGSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake: argument '%s' too long\n", buf);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
if (count >= MAXARGS)
|
||||
{
|
||||
fprintf(stderr, "cake: '%s' has too many arguments\n", cmd);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
count--;
|
||||
else
|
||||
{
|
||||
cdebug("<%s>", buf);
|
||||
vector[count] = new_name(buf);
|
||||
}
|
||||
}
|
||||
|
||||
vector[count] = NULL;
|
||||
cdebug("/%d\n", count);
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
** Strip one level of backslashes from the given string.
|
||||
*/
|
||||
|
||||
char *
|
||||
strip_backslash(str)
|
||||
reg char *str;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg char *s;
|
||||
reg int i;
|
||||
|
||||
if (index(str, '\\') == NULL)
|
||||
return str;
|
||||
|
||||
for (i = 0, s = str; *s != '\0'; s++)
|
||||
{
|
||||
if (*s != '\\')
|
||||
buf[i++] = *s;
|
||||
or (s[1] != '\0')
|
||||
buf[i++] = *++s;
|
||||
}
|
||||
|
||||
buf[i] = '\0';
|
||||
if (i >= MAXSIZE)
|
||||
{
|
||||
fprintf(stderr, "cake: command '%s' too long.\n", str);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
return new_name(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
** These functions implement mutual exclusion.
|
||||
** They prevent cake from being interrupted
|
||||
** between calls to lock and unlock.
|
||||
** This is used to preserve the consistency
|
||||
** of the active_procs data structure in the presence
|
||||
** of multiple executing children.
|
||||
*/
|
||||
|
||||
#if 0 /* mutual exclusion is not necessary & has bug */
|
||||
#ifdef ATT
|
||||
int (*signalint)();
|
||||
int (*signalquit)();
|
||||
#else
|
||||
int signalmask;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mutex_lock()
|
||||
{
|
||||
#if 0
|
||||
#ifdef ATT
|
||||
signalint = signal(SIGINT, SIG_IGN);
|
||||
signalquit = signal(SIGQUIT, SIG_IGN);
|
||||
#else
|
||||
signalmask = sigblock(mask(SIGINT)|mask(SIGQUIT));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
mutex_unlock()
|
||||
{
|
||||
#if 0
|
||||
#ifdef ATT
|
||||
signal(SIGINT, signalint);
|
||||
signal(SIGQUIT, signalquit);
|
||||
#else
|
||||
sigsetmask(signalmask);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
** Standard definitions for C
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
#define or else if
|
||||
#define when break;case
|
||||
#define otherwise break;default
|
||||
#define loop for(;;)
|
||||
#define until(expr) while(!(expr))
|
||||
#ifndef reg
|
||||
#define reg register
|
||||
#endif
|
||||
#ifndef bool
|
||||
#define bool char
|
||||
#endif
|
||||
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#define streq(s1, s2) (strcmp(s1, s2) == 0)
|
||||
#define strdiff(s1, s2) (strcmp(s1, s2) != 0)
|
||||
#define strneq(s1, s2, n) (strncmp(s1, s2, n) == 0)
|
||||
#define strndiff(s1, s2, n) (strncmp(s1, s2, n) != 0)
|
||||
|
||||
#define ungetchar(c) ungetc(c, stdin)
|
||||
#define make(type) ((type *) newmem(sizeof(type)))
|
||||
#define make_many(type, count) ((type *) newmem(count * sizeof(type)))
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define CNULL (char *) 0
|
||||
#define LNULL (List *) 0
|
||||
-277
@@ -1,277 +0,0 @@
|
||||
/*
|
||||
** Symbol table module
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
typedef struct s_out
|
||||
{
|
||||
char *o_cmd;
|
||||
char *o_out;
|
||||
} Out;
|
||||
|
||||
typedef struct s_stat
|
||||
{
|
||||
char *s_cmd;
|
||||
int s_stat;
|
||||
} Stat;
|
||||
|
||||
extern int hash();
|
||||
extern Cast name_key(); extern bool name_equal();
|
||||
extern Cast node_key(); extern bool node_equal();
|
||||
extern Cast out_key(); extern bool out_equal();
|
||||
extern Cast stat_key(); extern bool stat_equal();
|
||||
Table name_tab = { SIZE, NULL, name_key, hash, name_equal };
|
||||
Table node_tab = { SIZE, NULL, node_key, hash, node_equal };
|
||||
Table out_tab = { SIZE, NULL, out_key, hash, out_equal };
|
||||
Table stat_tab = { SIZE, NULL, stat_key, hash, stat_equal };
|
||||
|
||||
/*
|
||||
** Initialize the name and the command tables.
|
||||
*/
|
||||
|
||||
init_sym()
|
||||
{
|
||||
init_table(name_tab);
|
||||
init_table(node_tab);
|
||||
init_table(out_tab);
|
||||
init_table(stat_tab);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* Name table */
|
||||
|
||||
/*
|
||||
** Save the given string in the name table if not already there;
|
||||
** return its new address. This address is unique, so comparing
|
||||
** two identifiers for equality can be done by comparing their
|
||||
** addresses.
|
||||
*/
|
||||
|
||||
char *
|
||||
new_name(str)
|
||||
reg char *str;
|
||||
{
|
||||
reg Cast old;
|
||||
reg char *copy;
|
||||
|
||||
if ((old = lookup_table(name_tab, str)) != NULL)
|
||||
return (char *) old;
|
||||
|
||||
copy = (char *) newmem(strlen(str) + 1);
|
||||
strcpy(copy, str);
|
||||
insert_table(name_tab, copy);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
Cast
|
||||
name_key(entry)
|
||||
reg Cast entry;
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
bool
|
||||
name_equal(key1, key2)
|
||||
reg Cast key1, key2;
|
||||
{
|
||||
return streq((char *) key1, (char *) key2);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* Node table */
|
||||
|
||||
/*
|
||||
** Th insertion function for the node table is chase(),
|
||||
** which is in chase.c with the rest of the chase stuff.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This function merely reports on the results
|
||||
** of past calls to chase.
|
||||
*/
|
||||
|
||||
Node *
|
||||
chase_node(name)
|
||||
reg char *name;
|
||||
{
|
||||
return (Node *) lookup_table(node_tab, name);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a list of all the nodes of this run.
|
||||
*/
|
||||
|
||||
List *
|
||||
get_allnodes()
|
||||
{
|
||||
return contents_table(node_tab);
|
||||
}
|
||||
|
||||
Cast
|
||||
node_key(entry)
|
||||
reg Cast entry;
|
||||
{
|
||||
return (Cast) ((Node *) entry)->n_name;
|
||||
}
|
||||
|
||||
bool
|
||||
node_equal(key1, key2)
|
||||
reg Cast key1, key2;
|
||||
{
|
||||
#ifdef EXTRACHECK
|
||||
if (key1 != key2 && streq((char *) key1, (char *) key2))
|
||||
{
|
||||
fprintf(stderr, "cake internal error: inconsistency in node_equal\n");
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return key1 == key2;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* Command output table */
|
||||
|
||||
#ifdef STATS_FILE
|
||||
int out_tried = 0;
|
||||
int out_found = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Save a command and its output.
|
||||
*/
|
||||
|
||||
new_out(cmd, output)
|
||||
reg char *cmd;
|
||||
reg char *output;
|
||||
{
|
||||
reg Out *out;
|
||||
|
||||
out = make(Out);
|
||||
out->o_cmd = cmd;
|
||||
out->o_out = output;
|
||||
insert_table(out_tab, out);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the output if any associated with a given command.
|
||||
*/
|
||||
|
||||
char *
|
||||
get_out(cmd)
|
||||
reg char *cmd;
|
||||
{
|
||||
reg Out *out;
|
||||
|
||||
#ifdef STATS_FILE
|
||||
out_tried++;
|
||||
#endif
|
||||
|
||||
if ((out = (Out *) lookup_table(out_tab, cmd)) == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef STATS_FILE
|
||||
out_found++;
|
||||
#endif
|
||||
|
||||
return out->o_out;
|
||||
}
|
||||
|
||||
Cast
|
||||
out_key(entry)
|
||||
reg Cast entry;
|
||||
{
|
||||
return (Cast) ((Out *) entry)->o_cmd;
|
||||
}
|
||||
|
||||
bool
|
||||
out_equal(key1, key2)
|
||||
reg Cast key1, key2;
|
||||
{
|
||||
#ifdef EXTRACHECK
|
||||
if (key1 != key2 && streq((char *) key1, (char *) key2))
|
||||
{
|
||||
fprintf(stderr, "cake internal error: inconsistency in out_equal\n");
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return key1 == key2;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* Command status table */
|
||||
|
||||
#ifdef STATS_FILE
|
||||
int stat_tried = 0;
|
||||
int stat_found = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Save a command and its status.
|
||||
*/
|
||||
|
||||
new_stat(cmd, status)
|
||||
reg char *cmd;
|
||||
reg int status;
|
||||
{
|
||||
reg Stat *stat;
|
||||
|
||||
stat = make(Stat);
|
||||
stat->s_cmd = cmd;
|
||||
stat->s_stat = status;
|
||||
insert_table(stat_tab, stat);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the status if any associated with a given command.
|
||||
*/
|
||||
|
||||
bool
|
||||
get_stat(cmd, code)
|
||||
reg char *cmd;
|
||||
reg int *code;
|
||||
{
|
||||
reg Stat *stat;
|
||||
|
||||
#ifdef STATS_FILE
|
||||
stat_tried++;
|
||||
#endif
|
||||
|
||||
if ((stat = (Stat *) lookup_table(stat_tab, cmd)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
#ifdef STATS_FILE
|
||||
stat_found++;
|
||||
#endif
|
||||
|
||||
*code = stat->s_stat;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Cast
|
||||
stat_key(entry)
|
||||
reg Cast entry;
|
||||
{
|
||||
return (Cast) ((Stat *) entry)->s_cmd;
|
||||
}
|
||||
|
||||
bool
|
||||
stat_equal(key1, key2)
|
||||
reg Cast key1, key2;
|
||||
{
|
||||
#ifdef EXTRACHECK
|
||||
if (key1 != key2 && streq((char *) key1, (char *) key2))
|
||||
{
|
||||
fprintf(stderr, "cake internal error: inconsistency in stat_equal\n");
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return key1 == key2;
|
||||
}
|
||||
-156
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
** Cake system interface.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** Change to the directory of the cakefile.
|
||||
** Return the shortened name of the cakefile.
|
||||
*/
|
||||
|
||||
char *
|
||||
dir_setup(name)
|
||||
reg char *name;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg int i, l; /* l is the subscript of the last / */
|
||||
|
||||
l = -1;
|
||||
for (i = 0; name[i] != '\0'; i++)
|
||||
if (name[i] == '/')
|
||||
l = i;
|
||||
|
||||
if (l < 0)
|
||||
return name;
|
||||
else
|
||||
{
|
||||
for (i = 0; i < l; i++)
|
||||
buf[i] = name[i];
|
||||
|
||||
if (i == 0)
|
||||
buf[i++] = '/';
|
||||
|
||||
buf[i] = '\0';
|
||||
if (chdir(buf) != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "cake system error, chdir %s", buf);
|
||||
perror(scratchbuf);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return name+l+1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Set up the arguments to shell exec's.
|
||||
** pattern: execl("/bin/sh", "sh", "-c", s, 0);
|
||||
** pattern: execl("/bin/csh", "csh", "-cf", s, 0);
|
||||
*/
|
||||
|
||||
char *shell_path[2];
|
||||
char *shell_cmd[2];
|
||||
char *shell_opt[2];
|
||||
|
||||
shell_setup(shell, which)
|
||||
reg char *shell;
|
||||
reg int which;
|
||||
{
|
||||
char buf[MAXSIZE];
|
||||
reg char *s;
|
||||
reg int i, l;
|
||||
|
||||
/* find the shell path */
|
||||
i = 0;
|
||||
for (s = shell; *s != '\0' && *s != ' ' && *s != '\t'; s++)
|
||||
buf[i++] = *s;
|
||||
|
||||
buf[i] = '\0';
|
||||
shell_path[which] = new_name(buf);
|
||||
|
||||
for (; *s != '\0' && *s != '-'; s++)
|
||||
;
|
||||
|
||||
/* find the options */
|
||||
i = 0;
|
||||
for (; *s != '\0' && *s != ' ' && *s != '\t'; s++)
|
||||
buf[i++] = *s;
|
||||
|
||||
buf[i] = '\0';
|
||||
if (i != 0)
|
||||
shell_opt[which] = new_name(buf);
|
||||
else
|
||||
shell_opt[which] = NULL;
|
||||
|
||||
if (*s != NULL)
|
||||
{
|
||||
fprintf(stderr, "cake: cannot parse shell command '%s'\n", shell);
|
||||
exit_cake(FALSE);
|
||||
}
|
||||
|
||||
/* find the shell command itself */
|
||||
s = shell_path[which];
|
||||
l = -1;
|
||||
for (i = 0; s[i] != '\0'; i++)
|
||||
if (s[i] == '/')
|
||||
l = i;
|
||||
|
||||
shell_cmd[which] = new_name(s+l+1);
|
||||
|
||||
if (cakedebug)
|
||||
{
|
||||
printf("shell path%d: %s\n", which, shell_path[which]);
|
||||
printf("shell cmd%d: %s\n", which, shell_cmd[which]);
|
||||
if (shell_opt[which] != NULL)
|
||||
printf("shell opt%d: %s\n", which, shell_opt[which]);
|
||||
else
|
||||
printf("shell opt%d: NULL\n", which);
|
||||
}
|
||||
}
|
||||
|
||||
bool metatab[CHARSETSIZE];
|
||||
|
||||
/*
|
||||
** Set up the metacharacter table.
|
||||
*/
|
||||
|
||||
meta_setup(metachars)
|
||||
reg char *metachars;
|
||||
{
|
||||
reg int i;
|
||||
reg char *s;
|
||||
|
||||
for (i = 0; i < CHARSETSIZE; i++)
|
||||
metatab[i] = FALSE;
|
||||
|
||||
for (s = metachars; *s != '\0'; s++)
|
||||
metatab[*s] = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
** Decide whether the given string has metacharacters or not.
|
||||
** The second arg tells whether to honour backslash escapes.
|
||||
*/
|
||||
|
||||
bool
|
||||
has_meta(str, allow_esc)
|
||||
reg char *str;
|
||||
reg bool allow_esc;
|
||||
{
|
||||
reg char *s;
|
||||
|
||||
for (s = str; *s != '\0'; s++)
|
||||
if (metatab[(unsigned) *s])
|
||||
return TRUE;
|
||||
or (allow_esc && (*s == '\\'))
|
||||
{
|
||||
if (s[1] != '\0')
|
||||
s++;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
-135
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
** Table handling module.
|
||||
**
|
||||
** This file supplies data manipulation routines to other modules;
|
||||
** it does not store any data itself. Its routines are generic,
|
||||
** applicable to the storage of any kind of data structure with
|
||||
** primary key and a hash function on it.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
/*
|
||||
** Initialize a table.
|
||||
*/
|
||||
|
||||
_init_table(table)
|
||||
reg Table *table;
|
||||
{
|
||||
reg int i;
|
||||
|
||||
table->ta_store = make_many(List *, table->ta_size);
|
||||
for (i = 0; i < table->ta_size; i++)
|
||||
table->ta_store[i] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Look up and return the entry corresponding to the key
|
||||
** in a table.
|
||||
*/
|
||||
|
||||
Cast
|
||||
_lookup_table(table, key)
|
||||
reg Table *table;
|
||||
reg Cast key;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg int h;
|
||||
|
||||
put_trail("lookup_table", "start");
|
||||
h = tablehash(table)(key);
|
||||
for_list (ptr, table->ta_store[h])
|
||||
{
|
||||
if (tableequal(table)(key, tablekey(table)(ldata(ptr))))
|
||||
{
|
||||
#ifdef EXTRACHECK
|
||||
if (ldata(ptr) == NULL)
|
||||
{
|
||||
fprintf(stderr, "cake internal error: returning null in lookup_table\n");
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
#endif
|
||||
put_trail("lookup_table", "finish");
|
||||
return ldata(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
put_trail("lookup_table", "finish");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Insert a new entry into the table.
|
||||
** Return whether it was there before.
|
||||
*/
|
||||
|
||||
bool
|
||||
_insert_table(table, entry)
|
||||
reg Table *table;
|
||||
reg Cast entry;
|
||||
{
|
||||
reg List *ptr;
|
||||
reg Cast key;
|
||||
reg int h;
|
||||
|
||||
put_trail("insert_table", "start");
|
||||
key = tablekey(table)(entry);
|
||||
h = tablehash(table)(key);
|
||||
for_list (ptr, table->ta_store[h])
|
||||
if (tableequal(table)(key, tablekey(table)(ldata(ptr))))
|
||||
{
|
||||
put_trail("insert_table", "finish");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
table->ta_store[h] = addhead(table->ta_store[h], entry);
|
||||
put_trail("insert_table", "finish");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
** Hash str into the range 0 to SIZE-1.
|
||||
*/
|
||||
|
||||
int
|
||||
hash(s)
|
||||
reg char *s;
|
||||
{
|
||||
#ifdef CRAY
|
||||
reg long h;
|
||||
#else
|
||||
reg int h;
|
||||
#endif
|
||||
|
||||
for (h = 0; *s != '\0'; s++)
|
||||
h = (h << 1) + *s;
|
||||
|
||||
h = (h >= 0? h: -h) % SIZE;
|
||||
if( h < 0 || h > SIZE ) {
|
||||
fprintf(stderr, "cake: hash error, h=%d\n", h); /* BRL */
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a list of all the entries in a table.
|
||||
*/
|
||||
|
||||
List *
|
||||
_contents_table(table)
|
||||
reg Table *table;
|
||||
{
|
||||
reg List *all;
|
||||
reg List *ptr;
|
||||
reg int i;
|
||||
|
||||
all = makelist0();
|
||||
for (i = 0; i < table->ta_size; i++)
|
||||
for_list (ptr, table->ta_store[i])
|
||||
addtail(all, ldata(ptr)); /* na */
|
||||
|
||||
return all;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
** Definitions for the table module.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
typedef struct s_table
|
||||
{
|
||||
int ta_size; /* the size of the store */
|
||||
List **ta_store; /* the store, an array of lists */
|
||||
Cast (*ta_key)(); /* applied to entries */
|
||||
int (*ta_hash)(); /* applied to keys */
|
||||
bool (*ta_equal)(); /* applied to two keys */
|
||||
} Table;
|
||||
|
||||
#define init_table(t) _init_table(&t)
|
||||
#define lookup_table(t, k) _lookup_table(&t, (Cast) k)
|
||||
#define insert_table(t, e) _insert_table(&t, (Cast) e)
|
||||
#define contents_table(t) _contents_table(&t)
|
||||
|
||||
#define tablekey(table) (*(table->ta_key))
|
||||
#define tablehash(table) (*(table->ta_hash))
|
||||
#define tableequal(table) (*(table->ta_equal))
|
||||
|
||||
extern _init_table();
|
||||
extern Cast _lookup_table();
|
||||
extern bool _insert_table();
|
||||
extern List *_contents_table();
|
||||
-144
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
** Module to handle Cake's tests.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#include "cake.h"
|
||||
|
||||
bool
|
||||
eval(node, test, env)
|
||||
reg Node *node;
|
||||
reg Test *test;
|
||||
Env env;
|
||||
{
|
||||
extern char *expand_cmds();
|
||||
extern int cake_proc();
|
||||
extern Wait cake_wait();
|
||||
extern Node *chase();
|
||||
extern bool get_stat();
|
||||
extern bool exist();
|
||||
extern char *ground();
|
||||
char buf[256];
|
||||
Wait status;
|
||||
reg List *ptr;
|
||||
reg Pat *pat;
|
||||
reg char *text1, *text2;
|
||||
reg char *cmd;
|
||||
reg Node *chasenode;
|
||||
reg int result;
|
||||
reg int pid;
|
||||
|
||||
if (test == (Test *) NULL)
|
||||
return TRUE;
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
if (cakedebug)
|
||||
{
|
||||
printf("testing ");
|
||||
print_test(test);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (test->t_kind)
|
||||
{
|
||||
|
||||
when t_TRUE: return TRUE;
|
||||
when t_FALSE: return FALSE;
|
||||
when t_AND: return eval(node, test->t_left, env) && eval(node, test->t_right, env);
|
||||
when t_OR: return eval(node, test->t_left, env) || eval(node, test->t_right, env);
|
||||
when t_NOT: return ! eval(node, test->t_left, env);
|
||||
|
||||
when t_CMD: if (get_stat(test->t_cmd, &status.w_status))
|
||||
{
|
||||
test->t_kind = (status.w_status == 0)? t_TRUE: t_FALSE;
|
||||
cdebug("test cmd cache %s: %s\n", test->t_cmd,
|
||||
(status.w_status == 0)? "True": "False");
|
||||
return (status.w_status == 0)? TRUE: FALSE;
|
||||
}
|
||||
|
||||
cmd = expand_cmds(ground(env, test->t_cmd));
|
||||
pid = cake_proc(cmd, Exec, "/dev/null", (Node *) NULL,
|
||||
(int (*)()) NULL, (List *) NULL);
|
||||
status = cake_wait(pid);
|
||||
new_stat(test->t_cmd, status.w_status);
|
||||
test->t_kind = (status.w_status == 0)? t_TRUE: t_FALSE;
|
||||
cdebug("test cmd %s: %s\n", test->t_cmd,
|
||||
(status.w_status == 0)? "True": "False");
|
||||
return (status.w_status == 0)? TRUE: FALSE;
|
||||
|
||||
when t_MATCH: text1 = (char *) first(test->t_list); /* -vX */
|
||||
text2 = (char *) last(test->t_list); /* file */
|
||||
/* e.g. sub -vX X.c NULL file.c */
|
||||
sprintf(buf, "sub %s %s NULL %s > /dev/null",
|
||||
text1, text2, test->t_pat->p_str);
|
||||
|
||||
cmd = new_name(buf);
|
||||
cdebug("matching command: %s\n", cmd);
|
||||
if (get_stat(cmd, &status.w_status))
|
||||
{
|
||||
test->t_kind = (status.w_status == 0)? t_TRUE: t_FALSE;
|
||||
cdebug("test cmd cache %s: %s\n", test->t_cmd,
|
||||
(status.w_status == 0)? "True": "False");
|
||||
return (status.w_status == 0)? TRUE: FALSE;
|
||||
}
|
||||
|
||||
pid = cake_proc(cmd, Exec, "/dev/null", (Node *) NULL,
|
||||
(int (*)()) NULL, (List *) NULL);
|
||||
status = cake_wait(pid);
|
||||
new_stat(test->t_cmd, status.w_status);
|
||||
test->t_kind = (status.w_status == 0)? t_TRUE: t_FALSE;
|
||||
cdebug("test cmd %s: %s\n", test->t_cmd,
|
||||
(status.w_status == 0)? "True": "False");
|
||||
return (status.w_status == 0)? TRUE: FALSE;
|
||||
|
||||
when t_LIST: for_list (ptr, test->t_list)
|
||||
{
|
||||
pat = (Pat *) ldata(ptr);
|
||||
if (streq(test->t_pat->p_str, pat->p_str))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
when t_EXIST: result = exist(test->t_pat->p_str);
|
||||
cdebug("test exist %s: %s\n", test->t_pat->p_str,
|
||||
result? "True": "False");
|
||||
return result;
|
||||
|
||||
when t_CANDO: chasenode = chase(test->t_pat->p_str, 0, (Entry *) NULL);
|
||||
if (on_node(chasenode, nf_ERR))
|
||||
{
|
||||
sprintf(scratchbuf, "cannot evaluate 'cando %s' test for %s",
|
||||
chasenode->n_name, node->n_name);
|
||||
add_error(node, new_name(scratchbuf), LNULL, TRUE);
|
||||
}
|
||||
|
||||
result = is_ok(chasenode) || is_cando(chasenode);
|
||||
cdebug("test cando %s: %s\n", test->t_pat->p_str,
|
||||
result? "True": "False");
|
||||
return result;
|
||||
|
||||
when t_OK: chasenode = chase(test->t_pat->p_str, 0, (Entry *) NULL);
|
||||
if (on_node(chasenode, nf_ERR))
|
||||
{
|
||||
sprintf(scratchbuf, "cannot evaluate 'ok %s' test for %s",
|
||||
chasenode->n_name, node->n_name);
|
||||
add_error(node, new_name(scratchbuf), LNULL, TRUE);
|
||||
}
|
||||
|
||||
result = is_ok(chasenode);
|
||||
cdebug("test ok %s: %s\n", test->t_pat->p_str,
|
||||
result? "True": "False");
|
||||
return result;
|
||||
|
||||
otherwise: fprintf(stderr, "cake internal error: invalid test type %x in eval\n",
|
||||
test->t_kind);
|
||||
exit_cake(TRUE);
|
||||
}
|
||||
|
||||
/*NOTREACHED*/
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
** Trail module.
|
||||
*/
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Header$";
|
||||
|
||||
#ifdef CAKEDEBUG
|
||||
#include "cake.h"
|
||||
|
||||
#define TRAILSIZE 100
|
||||
|
||||
static int trail_entries = 0; /* no. of calls to put_tr */
|
||||
static int slot = 0; /* next slot */
|
||||
static char *trailfunc[TRAILSIZE]; /* functions and events */
|
||||
static char *trailevent[TRAILSIZE]; /* init to NULL by C */
|
||||
|
||||
/*
|
||||
** Register this function on the trail.
|
||||
*/
|
||||
|
||||
put_trail(func, event)
|
||||
reg char *func;
|
||||
reg char *event;
|
||||
{
|
||||
trailfunc[slot] = func;
|
||||
trailevent[slot] = event;
|
||||
|
||||
trail_entries++;
|
||||
if (++slot == TRAILSIZE)
|
||||
slot = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Print the trail on the given file.
|
||||
*/
|
||||
|
||||
get_trail(fp)
|
||||
reg FILE *fp;
|
||||
{
|
||||
reg int maxent;
|
||||
|
||||
fprintf(fp, "^^^^^^^^^^^^^^^^^^^ TRAIL ^^^^^^^^^^^^^^^^^^^\n");
|
||||
fprintf(fp, "%d entries\n", trail_entries);
|
||||
|
||||
maxent = (trail_entries < TRAILSIZE)? trail_entries: TRAILSIZE;
|
||||
while (maxent-- > 0)
|
||||
{
|
||||
if (--slot == -1)
|
||||
slot = TRAILSIZE - 1;
|
||||
|
||||
fprintf(fp, "%s %s\n", trailfunc[slot], trailevent[slot]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
** Compatibility for ATT versions of Unix
|
||||
** with Berkeley's wait system calls.
|
||||
**
|
||||
** $Header$
|
||||
*/
|
||||
|
||||
#ifdef ATT
|
||||
/*
|
||||
* Copyright (c) 1982 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*
|
||||
* @(#)wait.h 6.2 (Berkeley) 6/8/85
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds definitions relevent to the wait system call.
|
||||
* Some of the options here are available only through the ``wait3''
|
||||
* entry point; the old entry point with one argument has more fixed
|
||||
* semantics, never returning status of unstopped children, hanging until
|
||||
* a process terminates if any are outstanding, and never returns
|
||||
* detailed information about process resource utilization (<vtimes.h>).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure of the information in the first word returned by both
|
||||
* wait and wait3. If w_stopval==WSTOPPED, then the second structure
|
||||
* describes the information returned, else the first. See WUNTRACED below.
|
||||
*/
|
||||
union wait {
|
||||
int w_status; /* used in syscall */
|
||||
/*
|
||||
* Terminated process status.
|
||||
*/
|
||||
struct {
|
||||
unsigned short w_Termsig:7; /* termination signal */
|
||||
unsigned short w_Coredump:1; /* core dump indicator */
|
||||
unsigned short w_Retcode:8; /* exit code if w_termsig==0 */
|
||||
} w_T;
|
||||
/*
|
||||
* Stopped process status. Returned
|
||||
* only for traced children unless requested
|
||||
* with the WUNTRACED option bit.
|
||||
*/
|
||||
struct {
|
||||
unsigned short w_Stopval:8; /* == W_STOPPED if stopped */
|
||||
unsigned short w_Stopsig:8; /* signal that stopped us */
|
||||
} w_S;
|
||||
};
|
||||
#define w_termsig w_T.w_Termsig
|
||||
#define w_coredump w_T.w_Coredump
|
||||
#define w_retcode w_T.w_Retcode
|
||||
#define w_stopval w_S.w_Stopval
|
||||
#define w_stopsig w_S.w_Stopsig
|
||||
|
||||
|
||||
#define WSTOPPED 0177 /* value of s.stopval if process is stopped */
|
||||
|
||||
/*
|
||||
* Option bits for the second argument of wait3. WNOHANG causes the
|
||||
* wait to not hang if there are no stopped or terminated processes, rather
|
||||
* returning an error indication in this case (pid==0). WUNTRACED
|
||||
* indicates that the caller should receive status about untraced children
|
||||
* which stop due to signals. If children are stopped and a wait without
|
||||
* this option is done, it is as though they were still running... nothing
|
||||
* about them is returned.
|
||||
*/
|
||||
#define WNOHANG 1 /* dont hang in wait */
|
||||
#define WUNTRACED 2 /* tell about stopped, untraced children */
|
||||
|
||||
#define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED)
|
||||
#define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
|
||||
#define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
|
||||
#else
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define mask(s) (1 << ((s)-1))
|
||||
#endif
|
||||
|
||||
typedef union wait Wait;
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* conv/Cakefile
|
||||
*/
|
||||
|
||||
#define SRCDIR conv
|
||||
#define PRODUCTS asc2g g2asc conv-vg2g pix2asc asc2pix
|
||||
#define SRCSUFF .c
|
||||
#define MANSECTION 1
|
||||
|
||||
#include "../Cakefile.defs"
|
||||
#include "../Cakefile.prog"
|
||||
|
||||
/* Explicit composition of each product */
|
||||
|
||||
asc2g: asc2g.o
|
||||
CC LDFLAGS asc2g.o -o asc2g
|
||||
|
||||
g2asc: g2asc.o
|
||||
CC LDFLAGS g2asc.o -o g2asc
|
||||
|
||||
conv-vg2g: conv-vg2g.o
|
||||
CC LDFLAGS conv-vg2g.o -o conv-vg2g
|
||||
|
||||
pix2asc: pix2asc.o
|
||||
CC LDFLAGS pix2asc.o -o pix2asc
|
||||
|
||||
asc2pix: asc2pix.o
|
||||
CC LDFLAGS asc2pix.o -o asc2pix
|
||||
|
||||
#include "../Cakefile.rules"
|
||||
-739
@@ -1,739 +0,0 @@
|
||||
/*
|
||||
* A S C 2 G . C
|
||||
*
|
||||
* This program generates a GED database from an
|
||||
* ASCII GED data file.
|
||||
*
|
||||
* Usage: asc2g < file.asc > file.g
|
||||
*
|
||||
* Authors -
|
||||
* Charles M Kennedy
|
||||
* Michael J Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "db.h"
|
||||
|
||||
extern void exit();
|
||||
extern int atoi(); /* bzero()? */
|
||||
extern char *strcpy();
|
||||
extern double atof();
|
||||
|
||||
void identbld(), polyhbld(), polydbld();
|
||||
void solbld(), combbld(), membbld(), arsabld(), arsbbld();
|
||||
void materbld(), bsplbld(), bsurfbld(), zap_nl();
|
||||
char *nxt_spc();
|
||||
|
||||
static union record record; /* GED database record */
|
||||
#define BUFSIZE 1024 /* Record input buffer size */
|
||||
static char buf[BUFSIZE]; /* Record input buffer */
|
||||
|
||||
int debug;
|
||||
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
if( argc > 1 )
|
||||
debug = 1;
|
||||
|
||||
/* Read ASCII input file, each record on a line */
|
||||
while( ( fgets( buf, BUFSIZE, stdin ) ) != (char *)0 ) {
|
||||
|
||||
/* Clear the output record -- vital! */
|
||||
(void)bzero( (char *)&record, sizeof(record) );
|
||||
|
||||
/* Check record type */
|
||||
if( debug )
|
||||
(void)fprintf(stderr,"rec %c\n", buf[0] );
|
||||
switch( buf[0] ) {
|
||||
case ID_SOLID:
|
||||
solbld();
|
||||
continue;
|
||||
|
||||
case ID_COMB:
|
||||
combbld();
|
||||
continue;
|
||||
|
||||
case ID_MEMB:
|
||||
membbld();
|
||||
continue;
|
||||
|
||||
case ID_ARS_A:
|
||||
arsabld();
|
||||
continue;
|
||||
|
||||
case ID_ARS_B:
|
||||
arsbbld();
|
||||
continue;
|
||||
|
||||
case ID_P_HEAD:
|
||||
polyhbld();
|
||||
continue;
|
||||
|
||||
case ID_P_DATA:
|
||||
polydbld();
|
||||
continue;
|
||||
|
||||
case ID_IDENT:
|
||||
identbld();
|
||||
continue;
|
||||
|
||||
case ID_MATERIAL:
|
||||
materbld();
|
||||
continue;
|
||||
|
||||
case ID_BSOLID:
|
||||
bsplbld();
|
||||
continue;
|
||||
|
||||
case ID_BSURF:
|
||||
bsurfbld();
|
||||
continue;
|
||||
|
||||
default:
|
||||
(void)fprintf(stderr,"asc2g: bad record type '%c' (0%o), skipping\n", buf[0], buf[0]);
|
||||
(void)fprintf(stderr,"%s\n", buf );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
solbld() /* Build Solid record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
register int i;
|
||||
|
||||
cp = buf;
|
||||
record.s.s_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.s.s_type = (char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
np = record.s.s_name;
|
||||
while( *cp != ' ' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
record.s.s_cgtype = (short)atoi( cp );
|
||||
|
||||
for( i = 0; i < 24; i++ ) {
|
||||
cp = nxt_spc( cp );
|
||||
record.s.s_values[i] = atof( cp );
|
||||
}
|
||||
|
||||
if( debug ) {
|
||||
(void)fprintf(stderr,"%s ty%d [0]=%f,%f,%f [3]=%e,%e,%e\n",
|
||||
record.s.s_name, record.s.s_type,
|
||||
record.s.s_values[0],
|
||||
record.s.s_values[1],
|
||||
record.s.s_values[2],
|
||||
record.s.s_values[3],
|
||||
record.s.s_values[4],
|
||||
record.s.s_values[5] );
|
||||
}
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
combbld() /* Build Combination record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
int temp_nflag, temp_pflag;
|
||||
|
||||
record.c.c_override = 0;
|
||||
temp_nflag = temp_pflag = 0; /* indicators for optional fields */
|
||||
|
||||
cp = buf;
|
||||
record.c.c_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.c.c_flags = *cp++;
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
np = record.c.c_name;
|
||||
while( *cp != ' ' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
record.c.c_regionid = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_aircode = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_length = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_num = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_material = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_los = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_override = (char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
record.c.c_rgb[0] = (unsigned char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_rgb[1] = (unsigned char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_rgb[2] = (unsigned char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
temp_nflag = atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
temp_pflag = atoi( cp );
|
||||
|
||||
cp = nxt_spc( cp );
|
||||
record.c.c_inherit = atoi( cp );
|
||||
|
||||
if( record.c.c_flags == 'Y' )
|
||||
record.c.c_flags = 'R';
|
||||
else
|
||||
record.c.c_flags = ' ';
|
||||
|
||||
if( temp_nflag ) {
|
||||
fgets( buf, BUFSIZE, stdin );
|
||||
zap_nl();
|
||||
strncpy( record.c.c_matname, buf, sizeof(record.c.c_matname)-1 );
|
||||
}
|
||||
if( temp_pflag ) {
|
||||
fgets( buf, BUFSIZE, stdin );
|
||||
zap_nl();
|
||||
strncpy( record.c.c_matparm, buf, sizeof(record.c.c_matparm)-1 );
|
||||
}
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
membbld() /* Build Member record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
register int i;
|
||||
|
||||
cp = buf;
|
||||
record.M.m_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.M.m_relation = *cp++;
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
np = record.M.m_instname;
|
||||
while( *cp != ' ' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
record.M.m_mat[i] = atof( cp );
|
||||
cp = nxt_spc( cp );
|
||||
}
|
||||
|
||||
record.M.m_num = (short)atoi( cp );
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
arsabld() /* Build ARS A record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
|
||||
cp = buf;
|
||||
record.a.a_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.a.a_type = (char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
np = record.a.a_name;
|
||||
while( *cp != ' ' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
record.a.a_m = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_n = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_curlen = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_totlen = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
record.a.a_xmax = atof( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_xmin = atof( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_ymax = atof( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_ymin = atof( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_zmax = atof( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.a.a_zmin = atof( cp );
|
||||
|
||||
#ifdef never
|
||||
(void)sscanf( buf, "%c %d %s %d %d %d %d %f %f %f %f %f %f",
|
||||
&record.a.a_id,
|
||||
&temp1,
|
||||
&record.a.a_name[0],
|
||||
&temp2,
|
||||
&temp3,
|
||||
&temp4,
|
||||
&temp5,
|
||||
&record.a.a_xmax,
|
||||
&record.a.a_xmin,
|
||||
&record.a.a_ymax,
|
||||
&record.a.a_ymin,
|
||||
&record.a.a_zmax,
|
||||
&record.a.a_zmin
|
||||
);
|
||||
record.a.a_type = (char)temp1;
|
||||
record.a.a_m = (short)temp2;
|
||||
record.a.a_n = (short)temp3;
|
||||
record.a.a_curlen = (short)temp4;
|
||||
record.a.a_totlen = (short)temp5;
|
||||
#endif
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
arsbbld() /* Build ARS B record */
|
||||
{
|
||||
register char *cp;
|
||||
register int i;
|
||||
|
||||
cp = buf;
|
||||
record.b.b_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.b.b_type = (char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.b.b_n = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.b.b_ngranule = (short)atoi( cp );
|
||||
|
||||
for( i = 0; i < 24; i++ ) {
|
||||
cp = nxt_spc( cp );
|
||||
record.b.b_values[i] = atof( cp );
|
||||
}
|
||||
|
||||
#ifdef never
|
||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */
|
||||
(void)sscanf( buf, "%c %d %d %d %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
|
||||
&record.b.b_id,
|
||||
&temp1,
|
||||
&temp2,
|
||||
&temp3,
|
||||
&record.b.b_values[0],
|
||||
&record.b.b_values[1],
|
||||
&record.b.b_values[2],
|
||||
&record.b.b_values[3],
|
||||
&record.b.b_values[4],
|
||||
&record.b.b_values[5],
|
||||
&record.b.b_values[6],
|
||||
&record.b.b_values[7],
|
||||
&record.b.b_values[8],
|
||||
&record.b.b_values[9],
|
||||
&record.b.b_values[10],
|
||||
&record.b.b_values[11],
|
||||
&record.b.b_values[12],
|
||||
&record.b.b_values[13],
|
||||
&record.b.b_values[14],
|
||||
&record.b.b_values[15],
|
||||
&record.b.b_values[16],
|
||||
&record.b.b_values[17],
|
||||
&record.b.b_values[18],
|
||||
&record.b.b_values[19],
|
||||
&record.b.b_values[20],
|
||||
&record.b.b_values[21],
|
||||
&record.b.b_values[22],
|
||||
&record.b.b_values[23]
|
||||
);
|
||||
record.b.b_type = (char)temp1;
|
||||
record.b.b_n = (short)temp2;
|
||||
record.b.b_ngranule = (short)temp3;
|
||||
#endif
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
zap_nl()
|
||||
{
|
||||
register char *bp;
|
||||
|
||||
bp = &buf[0];
|
||||
|
||||
while( *bp != '\0' ) {
|
||||
if( *bp == '\n' )
|
||||
*bp = '\0';
|
||||
bp++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
identbld() /* Build Ident record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
|
||||
cp = buf;
|
||||
record.i.i_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.i.i_units = (char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
np = record.i.i_version;
|
||||
while( *cp != '\n' && *cp != '\0' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
|
||||
(void)fgets( buf, BUFSIZE, stdin);
|
||||
zap_nl();
|
||||
(void)strcpy( &record.i.i_title[0], buf );
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
polyhbld() /* Build Polyhead record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
|
||||
cp = buf;
|
||||
record.p.p_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
np = record.p.p_name;
|
||||
while( *cp != '\0' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
|
||||
#ifdef never
|
||||
(void)sscanf( buf, "%c %s",
|
||||
&record.p.p_id,
|
||||
&record.p.p_name[0]
|
||||
);
|
||||
#endif
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
polydbld() /* Build Polydata record */
|
||||
{
|
||||
register char *cp;
|
||||
register int i, j;
|
||||
|
||||
cp = buf;
|
||||
record.q.q_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.q.q_count = (char)atoi( cp );
|
||||
|
||||
for( i = 0; i < 5; i++ ) {
|
||||
for( j = 0; j < 3; j++ ) {
|
||||
cp = nxt_spc( cp );
|
||||
record.q.q_verts[i][j] = atof( cp );
|
||||
}
|
||||
}
|
||||
|
||||
for( i = 0; i < 5; i++ ) {
|
||||
for( j = 0; j < 3; j++ ) {
|
||||
cp = nxt_spc( cp );
|
||||
record.q.q_norms[i][j] = atof( cp );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef never
|
||||
int temp1;
|
||||
|
||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
|
||||
(void)sscanf( buf, "%c %d %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
|
||||
&record.q.q_id,
|
||||
&temp1,
|
||||
&record.q.q_verts[0][0],
|
||||
&record.q.q_verts[0][1],
|
||||
&record.q.q_verts[0][2],
|
||||
&record.q.q_verts[1][0],
|
||||
&record.q.q_verts[1][1],
|
||||
&record.q.q_verts[1][2],
|
||||
&record.q.q_verts[2][0],
|
||||
&record.q.q_verts[2][1],
|
||||
&record.q.q_verts[2][2],
|
||||
&record.q.q_verts[3][0],
|
||||
&record.q.q_verts[3][1],
|
||||
&record.q.q_verts[3][2],
|
||||
&record.q.q_verts[4][0],
|
||||
&record.q.q_verts[4][1],
|
||||
&record.q.q_verts[4][2],
|
||||
&record.q.q_norms[0][0],
|
||||
&record.q.q_norms[0][1],
|
||||
&record.q.q_norms[0][2],
|
||||
&record.q.q_norms[1][0],
|
||||
&record.q.q_norms[1][1],
|
||||
&record.q.q_norms[1][2],
|
||||
&record.q.q_norms[2][0],
|
||||
&record.q.q_norms[2][1],
|
||||
&record.q.q_norms[2][2],
|
||||
&record.q.q_norms[3][0],
|
||||
&record.q.q_norms[3][1],
|
||||
&record.q.q_norms[3][2],
|
||||
&record.q.q_norms[4][0],
|
||||
&record.q.q_norms[4][1],
|
||||
&record.q.q_norms[4][2]
|
||||
);
|
||||
record.q.q_count = (char)temp1;
|
||||
#endif
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
materbld()
|
||||
{
|
||||
register char *cp;
|
||||
|
||||
cp = buf;
|
||||
record.md.md_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.md.md_flags = (char)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.md.md_low = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.md.md_hi = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.md.md_r = (unsigned char)atoi( cp);
|
||||
cp = nxt_spc( cp );
|
||||
record.md.md_g = (unsigned char)atoi( cp);
|
||||
cp = nxt_spc( cp );
|
||||
record.md.md_b = (unsigned char)atoi( cp);
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
bsplbld() /* Build B-spline solid record */
|
||||
{
|
||||
register char *cp;
|
||||
register char *np;
|
||||
|
||||
cp = buf;
|
||||
record.B.B_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
np = record.B.B_name;
|
||||
while( *cp != ' ' ) {
|
||||
*np++ = *cp++;
|
||||
}
|
||||
cp = nxt_spc( cp );
|
||||
|
||||
record.B.B_nsurf = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.B.B_resolution = atof( cp );
|
||||
|
||||
#ifdef never
|
||||
(void)sscanf( buf, "%c %s %d %f",
|
||||
&record.B.B_id,
|
||||
&record.B.B_name[0],
|
||||
&temp1,
|
||||
&record.B.B_resolution
|
||||
);
|
||||
record.B.B_nsurf = (short)temp1;
|
||||
#endif
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
}
|
||||
|
||||
void
|
||||
bsurfbld() /* Build d-spline surface description record */
|
||||
{
|
||||
register char *cp;
|
||||
register int i;
|
||||
register float *vp;
|
||||
int nbytes, count;
|
||||
float *fp;
|
||||
|
||||
cp = buf;
|
||||
record.d.d_id = *cp++;
|
||||
cp = nxt_spc( cp ); /* skip the space */
|
||||
|
||||
record.d.d_order[0] = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_order[1] = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_kv_size[0] = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_kv_size[1] = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_ctl_size[0] = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_ctl_size[1] = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_geom_type = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_nknots = (short)atoi( cp );
|
||||
cp = nxt_spc( cp );
|
||||
record.d.d_nctls = (short)atoi( cp );
|
||||
|
||||
record.d.d_nknots =
|
||||
ngran( record.d.d_kv_size[0] + record.d.d_kv_size[1] );
|
||||
|
||||
record.d.d_nctls =
|
||||
ngran( record.d.d_ctl_size[0] * record.d.d_ctl_size[1]
|
||||
* record.d.d_geom_type);
|
||||
|
||||
#ifdef never
|
||||
int temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9;
|
||||
|
||||
(void)sscanf( buf, "%c %d %d %d %d %d %d %d %d %d",
|
||||
&record.d.d_id,
|
||||
&temp1,
|
||||
&temp2,
|
||||
&temp3,
|
||||
&temp4,
|
||||
&temp5,
|
||||
&temp6,
|
||||
&temp7,
|
||||
&temp8,
|
||||
&temp9
|
||||
);
|
||||
record.d.d_order[0] = (short)temp1;
|
||||
record.d.d_order[1] = (short)temp2;
|
||||
record.d.d_kv_size[0] = (short)temp3;
|
||||
record.d.d_kv_size[1] = (short)temp4;
|
||||
record.d.d_ctl_size[0] = (short)temp5;
|
||||
record.d.d_ctl_size[1] = (short)temp6;
|
||||
record.d.d_geom_type = (short)temp7;
|
||||
record.d.d_nknots = (short)temp8;
|
||||
record.d.d_nctls = (short)temp9;
|
||||
#endif
|
||||
|
||||
/* Write out the record */
|
||||
(void)fwrite( (char *)&record, sizeof record, 1, stdout );
|
||||
|
||||
/*
|
||||
* The b_surf_head record is followed by
|
||||
* d_nknots granules of knot vectors (first u, then v),
|
||||
* and then by d_nctls granules of control mesh information.
|
||||
* Note that neither of these have an ID field!
|
||||
*
|
||||
* B-spline surface record, followed by
|
||||
* d_kv_size[0] floats,
|
||||
* d_kv_size[1] floats,
|
||||
* padded to d_nknots granules, followed by
|
||||
* ctl_size[0]*ctl_size[1]*geom_type floats,
|
||||
* padded to d_nctls granules.
|
||||
*
|
||||
* IMPORTANT NOTE: granule == sizeof(union record)
|
||||
*/
|
||||
|
||||
/* Malloc and clear memory for the KNOT DATA and read it */
|
||||
nbytes = record.d.d_nknots * sizeof(union record);
|
||||
if( (vp = (float *)malloc(nbytes)) == (float *)0 ) {
|
||||
(void)fprintf(stderr, "asc2g: spline knot malloc error\n");
|
||||
exit(1);
|
||||
}
|
||||
fp = vp;
|
||||
(void)bzero( (char *)vp, nbytes );
|
||||
/* Read the knot vector information */
|
||||
count = record.d.d_kv_size[0] + record.d.d_kv_size[1];
|
||||
for( i = 0; i < count; i++ ) {
|
||||
fgets( buf, BUFSIZE, stdin );
|
||||
(void)sscanf( buf, "%f", vp++);
|
||||
}
|
||||
/* Write out the information */
|
||||
(void)fwrite( (char *)fp, nbytes, 1, stdout );
|
||||
|
||||
/* Free the knot data memory */
|
||||
(void)free( (char *)fp );
|
||||
|
||||
/* Malloc and clear memory for the CONTROL MESH data and read it */
|
||||
nbytes = record.d.d_nctls * sizeof(union record);
|
||||
if( (vp = (float *)malloc(nbytes)) == (float *)0 ) {
|
||||
(void)fprintf(stderr, "asc2g: control mesh malloc error\n");
|
||||
exit(1);
|
||||
}
|
||||
fp = vp;
|
||||
(void)bzero( (char *)vp, nbytes );
|
||||
/* Read the control mesh information */
|
||||
count = record.d.d_ctl_size[0] * record.d.d_ctl_size[1] *
|
||||
record.d.d_geom_type;
|
||||
for( i = 0; i < count; i++ ) {
|
||||
fgets( buf, BUFSIZE, stdin );
|
||||
(void)sscanf( buf, "%f", vp++);
|
||||
}
|
||||
/* Write out the information */
|
||||
(void)fwrite( (char *)fp, nbytes, 1, stdout );
|
||||
|
||||
/* Free the control mesh memory */
|
||||
(void)free( (char *)fp );
|
||||
}
|
||||
|
||||
char *
|
||||
nxt_spc( cp)
|
||||
register char *cp;
|
||||
{
|
||||
while( *cp != ' ' && *cp != '\t' && *cp !='\0' ) {
|
||||
cp++;
|
||||
}
|
||||
if( *cp != '\0' ) {
|
||||
cp++;
|
||||
}
|
||||
return( cp );
|
||||
}
|
||||
|
||||
ngran( nfloat )
|
||||
{
|
||||
register int gran;
|
||||
/* Round up */
|
||||
gran = nfloat + ((sizeof(union record)-1) / sizeof(float) );
|
||||
gran = (gran * sizeof(float)) / sizeof(union record);
|
||||
return(gran);
|
||||
}
|
||||
|
||||
#ifdef SYSV
|
||||
|
||||
bzero( str, n )
|
||||
register char *str;
|
||||
register int n;
|
||||
{
|
||||
while( n-- > 0 )
|
||||
*str++ = '\0';
|
||||
}
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* A S C 2 P I X . C
|
||||
*
|
||||
* Convert ASCII (hex) pixel files to the binary form.
|
||||
* For portable images.
|
||||
*
|
||||
* Author -
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int lmap[256]; /* Map HEX ASCII to binary in left nybble */
|
||||
int rmap[256]; /* Map HEX ASCII to binary in right nybble */
|
||||
|
||||
unsigned char line[256];
|
||||
|
||||
main()
|
||||
{
|
||||
register unsigned char *cp;
|
||||
register int i;
|
||||
|
||||
/* Init map */
|
||||
for(i=0; i<10; i++) rmap['0'+i] = i;
|
||||
for(i=10; i<16; i++) rmap['A'-10+i] = i;
|
||||
for(i=10; i<16; i++) rmap['a'-10+i] = i;
|
||||
for(i=0;i<256;i++) lmap[i] = rmap[i]<<4;
|
||||
|
||||
for(;;) {
|
||||
(void)fgets((char *)line, sizeof(line), stdin);
|
||||
if( feof(stdin) ) break;
|
||||
cp = line;
|
||||
|
||||
/* R */
|
||||
i = lmap[*cp++];
|
||||
i |= rmap[*cp++];
|
||||
putc( i, stdout );
|
||||
|
||||
/* G */
|
||||
i = lmap[*cp++];
|
||||
i |= rmap[*cp++];
|
||||
putc( i, stdout );
|
||||
|
||||
/* B */
|
||||
i = lmap[*cp++];
|
||||
i |= rmap[*cp++];
|
||||
putc( i, stdout );
|
||||
|
||||
/* Ignore rest of line, for now */
|
||||
}
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
.TH CONV-VG2G 1 BRL/CAD
|
||||
.SH NAME
|
||||
conv-vg2g \- upgrade old to new format binary MGED database
|
||||
.SH SYNOPSIS
|
||||
.B conv-vg2g
|
||||
file.vg file.g
|
||||
.SH DESCRIPTION
|
||||
.I Conv-vg2g
|
||||
converts several older forms of binary
|
||||
.IR mged (1)
|
||||
databases to the current form.
|
||||
.PP
|
||||
The conversion from version 3 to version 4 (the current version)
|
||||
is fairly straightforward.
|
||||
Conversion from older versions requires additional information,
|
||||
for which the user is prompted. The units of the database must
|
||||
be specified as:
|
||||
1=mm, 2=cm, 3=meters, 4=inches, 5=feet.
|
||||
A title for the database is also requested.
|
||||
.SH SEE ALSO
|
||||
brlcad(1), mged(1), libged(3)
|
||||
.SH DIAGNOSTICS
|
||||
Error messages are intended to be self-explanatory,
|
||||
and usually indicate errors in the input database.
|
||||
It may be possible to rescue a damaged old database
|
||||
by suitably modifying the source code to the converter.
|
||||
.SH AUTHOR
|
||||
Keith A. Applin
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@BRL.MIL>.
|
||||
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* C V . C
|
||||
*
|
||||
* Converts .vg files to .g (latest style, with idents).
|
||||
*
|
||||
* Authors -
|
||||
* Mike Muuss, BRL, 5/25/84.
|
||||
* Keith A. Applin
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "db.h"
|
||||
|
||||
void mat_pr();
|
||||
|
||||
union record rec;
|
||||
|
||||
char line[256];
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
static int ifd, ofd;
|
||||
static int units;
|
||||
static int count;
|
||||
static int i;
|
||||
double factor = 1.0;
|
||||
|
||||
if( argc != 3 ) {
|
||||
printf("Usage: conv-vg2g file.vg file.g\n");
|
||||
exit(11);
|
||||
}
|
||||
if( (ifd = open( argv[1], 0 )) < 0 ) {
|
||||
perror(argv[1]);
|
||||
exit(12);
|
||||
}
|
||||
if( (ofd = creat(argv[2], 0664)) < 0 ) {
|
||||
perror(argv[2]);
|
||||
exit(13);
|
||||
}
|
||||
|
||||
/* check for conversion from version 3 to version 4 */
|
||||
read(ifd, &rec, sizeof rec);
|
||||
if(rec.u_id == ID_IDENT) {
|
||||
/* have an mged type file - check its version */
|
||||
if( strcmp(rec.i.i_version, ID_VERSION) == 0 ) {
|
||||
(void)printf("%s: NO conversion necessary\n", argv[1]);
|
||||
(void)putchar(7);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
else {
|
||||
/* convert from version 3 to version 4 */
|
||||
(void)printf("convert from ver 3 to ver 4\n");
|
||||
units = ID_IN_UNIT;
|
||||
rec.i.i_version[0] = '\0';
|
||||
strcpy(rec.i.i_version, ID_VERSION);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lseek(ifd, 0L, 0);
|
||||
/* have an old vged file to convert */
|
||||
|
||||
/* units are inportant now because:
|
||||
* The ged data records will be stored in a constant BASE unit
|
||||
* of MiliMeters (MM).
|
||||
* At any time the ged user can change his local units.
|
||||
* Hence cv must know the original units of the ".vg" file so
|
||||
* that they can be converted to BASE units.
|
||||
*/
|
||||
(void)printf("* * V E R Y I M P O R T A N T N O T I C E * *\n");
|
||||
(void)printf(" You must KNOW the units of the %s file\n",argv[1]);
|
||||
(void)printf(" If you don't know, DON'T guess....find out\n");
|
||||
(void)putchar( 7 );
|
||||
|
||||
rec.i.i_id = ID_IDENT;
|
||||
strcpy( rec.i.i_version, ID_VERSION );
|
||||
rec.i.i_units = 100;
|
||||
while( rec.i.i_units < ID_MM_UNIT || rec.i.i_units > ID_FT_UNIT ) {
|
||||
printf("Units: 1=mm, 2=cm, 3=meters, 4=inches, 5=feet\nUnits? ");
|
||||
gets( line );
|
||||
sscanf( line, "%d", &units );
|
||||
rec.i.i_units = units;
|
||||
printf("units=%d\n", rec.i.i_units);
|
||||
}
|
||||
printf("Title? "); fflush(stdout);
|
||||
gets( line );
|
||||
strncpy( rec.i.i_title, line, 71 );
|
||||
rec.i.i_title[71] = '\0';
|
||||
printf("Title=%s\n", rec.i.i_title );
|
||||
}
|
||||
|
||||
write( ofd, &rec, sizeof rec );
|
||||
count = 1;
|
||||
|
||||
/* find the units scale factor */
|
||||
switch( units ) {
|
||||
|
||||
case ID_MM_UNIT:
|
||||
factor = 1.0; /* from MM to MM */
|
||||
break;
|
||||
|
||||
case ID_CM_UNIT:
|
||||
factor = 10.0; /* from CM to MM */
|
||||
break;
|
||||
|
||||
case ID_M_UNIT:
|
||||
factor = 1000.0; /* from M to MM */
|
||||
break;
|
||||
|
||||
case ID_IN_UNIT:
|
||||
factor = 25.4; /* from IN to MM */
|
||||
break;
|
||||
|
||||
case ID_FT_UNIT:
|
||||
factor = 304.8; /* from FT to MM */
|
||||
break;
|
||||
default:
|
||||
printf("eh?\n");
|
||||
}
|
||||
|
||||
top:
|
||||
while( read( ifd, &rec, sizeof rec ) == sizeof rec ) {
|
||||
switch( rec.u_id ) {
|
||||
|
||||
case ID_IDENT:
|
||||
printf("Unexpected ID record encountered in input\n");
|
||||
printf("Title=%s\n", rec.i.i_title );
|
||||
break;
|
||||
case ID_FREE:
|
||||
goto top;
|
||||
case ID_SOLID:
|
||||
if( rec.s.s_name[0] == '\0' )
|
||||
goto top;
|
||||
for(i=0; i<24; i++)
|
||||
rec.s.s_values[i] *= factor;
|
||||
break;
|
||||
case ID_COMB:
|
||||
if( rec.c.c_name[0] == '\0' ) {
|
||||
/* Skip deleted junk */
|
||||
lseek( ifd, (long)rec.c.c_length *
|
||||
(long)(sizeof rec), 1 );
|
||||
goto top;
|
||||
}
|
||||
break;
|
||||
case ID_ARS_B:
|
||||
for(i=0; i<24; i++)
|
||||
rec.b.b_values[i] *= factor;
|
||||
break;
|
||||
case ID_ARS_A:
|
||||
if( rec.a.a_name[0] == '\0' ) {
|
||||
/* Skip deleted junk */
|
||||
lseek( ifd, (long)(rec.a.a_totlen) *
|
||||
(long)(sizeof rec), 1 );
|
||||
goto top;
|
||||
}
|
||||
rec.a.a_xmin *= factor;
|
||||
rec.a.a_xmax *= factor;
|
||||
rec.a.a_ymin *= factor;
|
||||
rec.a.a_ymax *= factor;
|
||||
rec.a.a_zmin *= factor;
|
||||
rec.a.a_zmax *= factor;
|
||||
break;
|
||||
case ID_P_HEAD:
|
||||
case ID_P_DATA:
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Garbage record in database\n");
|
||||
exit(42);
|
||||
case ID_MEMB:
|
||||
/* flip translation to other side */
|
||||
#define m rec.M.m_mat
|
||||
m[3] *= factor;
|
||||
m[7] *= factor;
|
||||
m[11] *= factor;
|
||||
break;
|
||||
}
|
||||
write( ofd, &rec, sizeof(rec) );
|
||||
count++;
|
||||
}
|
||||
printf("%d database granules written\n", count);
|
||||
}
|
||||
|
||||
void
|
||||
mat_pr( title, mp )
|
||||
char *title;
|
||||
float *mp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
printf("MATRIX %s:\n ", title);
|
||||
for(i=0; i<16; i++) {
|
||||
printf(" %8.3f", mp[i]);
|
||||
if( (i&3) == 3 ) printf("\n ");
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
.TH G2ASC 1 BRL/CAD
|
||||
.SH NAME
|
||||
g2asc,
|
||||
asc2g \- convert between binary and ASCII MGED databases.
|
||||
.SH SYNOPSIS
|
||||
.B g2asc
|
||||
< file.g > file.asc
|
||||
.br
|
||||
.B asc2g
|
||||
< file.asc > file.g
|
||||
.SH DESCRIPTION
|
||||
The local machine binary representation
|
||||
of an
|
||||
.IR mged (1)
|
||||
database is inherently non-portable.
|
||||
.I G2asc
|
||||
and
|
||||
.I asc2g
|
||||
are simple filters which convert between
|
||||
the binary form and a portable ASCII representation.
|
||||
Any warning messages are written to standard error.
|
||||
.PP
|
||||
.I G2asc
|
||||
and
|
||||
.I asc2g
|
||||
are typically used to convert binary
|
||||
.IR mged (1)
|
||||
files to a portable ASCII format so the files can be transferred
|
||||
to another machine. On the local machine, files are converted to ASCII using
|
||||
.IR g2asc (1),
|
||||
then transferred to the remote machine. On the remote machine, the files
|
||||
are then converted back to the binary representation for that machine using
|
||||
.IR asc2g (1).
|
||||
.SH EXAMPLE
|
||||
.I
|
||||
g2asc < file.g > file.asc
|
||||
.br
|
||||
rcp file.asc remote:file.asc
|
||||
.br
|
||||
rsh remote "asc2g < file.asc > file.g"
|
||||
.SH DIAGNOSTICS
|
||||
The diagnostics are intended to be self-explanatory.
|
||||
.SH SEE ALSO
|
||||
brlcad(1), mged(1)
|
||||
.SH AUTHOR
|
||||
Charles Michael Kennedy
|
||||
.br
|
||||
Michael John Muuss
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH BUG REPORTS
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@BRL.MIL>.
|
||||
-461
@@ -1,461 +0,0 @@
|
||||
/*
|
||||
* G 2 A S C . C
|
||||
*
|
||||
* This program generates an ASCII data file which contains
|
||||
* a GED database.
|
||||
*
|
||||
* Usage: g2asc < file.g > file.asc
|
||||
*
|
||||
* Author -
|
||||
* Charles M Kennedy
|
||||
* Michael J Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "db.h"
|
||||
|
||||
extern void exit();
|
||||
|
||||
char *name();
|
||||
char *strchop();
|
||||
#define CH(x) strchop(x,sizeof(x))
|
||||
|
||||
void idendump(), polyhead(), polydata();
|
||||
void soldump(), combdump(), membdump(), arsadump(), arsbdump();
|
||||
void materdump(), bspldump(), bsurfdump();
|
||||
|
||||
union record record; /* GED database record */
|
||||
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
/* Read database file */
|
||||
while( fread( (char *)&record, sizeof record, 1, stdin ) == 1 &&
|
||||
!feof(stdin) ) {
|
||||
if( argc > 1 )
|
||||
(void)fprintf(stderr,"0%o (%c)\n", record.u_id, record.u_id);
|
||||
/* Check record type and skip deleted records */
|
||||
switch( record.u_id ) {
|
||||
case ID_FREE:
|
||||
continue;
|
||||
case ID_SOLID:
|
||||
soldump();
|
||||
continue;
|
||||
case ID_COMB:
|
||||
combdump();
|
||||
continue;
|
||||
case ID_ARS_A:
|
||||
arsadump();
|
||||
continue;
|
||||
case ID_P_HEAD:
|
||||
polyhead();
|
||||
continue;
|
||||
case ID_P_DATA:
|
||||
polydata();
|
||||
continue;
|
||||
case ID_IDENT:
|
||||
idendump();
|
||||
continue;
|
||||
case ID_MATERIAL:
|
||||
materdump();
|
||||
continue;
|
||||
case ID_BSOLID:
|
||||
bspldump();
|
||||
continue;
|
||||
case ID_BSURF:
|
||||
bsurfdump();
|
||||
continue;
|
||||
default:
|
||||
(void)fprintf(stderr,
|
||||
"g2asc: unable to convert record type '%c' (0%o), skipping\n",
|
||||
record.u_id, record.u_id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
idendump() /* Print out Ident record information */
|
||||
{
|
||||
(void)printf( "%c %d %.6s\n",
|
||||
record.i.i_id, /* I */
|
||||
record.i.i_units, /* units */
|
||||
CH(record.i.i_version) /* version */
|
||||
);
|
||||
(void)printf( "%.72s\n",
|
||||
CH(record.i.i_title) /* title or description */
|
||||
);
|
||||
|
||||
/* Print a warning message on stderr if versions differ */
|
||||
if( strcmp( record.i.i_version, ID_VERSION ) != 0 ) {
|
||||
(void)fprintf(stderr,
|
||||
"g2asc: File is version (%s), Program is version (%s)\n",
|
||||
record.i.i_version, ID_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
polyhead() /* Print out Polyhead record information */
|
||||
{
|
||||
(void)printf("%c ", record.p.p_id ); /* P */
|
||||
(void)printf("%.16s", name(record.p.p_name) ); /* unique name */
|
||||
(void)printf("\n"); /* Terminate w/ a newline */
|
||||
}
|
||||
|
||||
void
|
||||
polydata() /* Print out Polydata record information */
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
(void)printf("%c ", record.q.q_id ); /* Q */
|
||||
(void)printf("%d ", record.q.q_count ); /* # of vertices <= 5 */
|
||||
for( i = 0; i < 5; i++ ) { /* [5][3] vertices */
|
||||
for( j = 0; j < 3; j++ ) {
|
||||
(void)printf("%.12e ", record.q.q_verts[i][j] );
|
||||
}
|
||||
}
|
||||
for( i = 0; i < 5; i++ ) { /* [5][3] normals */
|
||||
for( j = 0; j < 3; j++ ) {
|
||||
(void)printf("%.12e ", record.q.q_norms[i][j] );
|
||||
}
|
||||
}
|
||||
(void)printf("\n"); /* Terminate w/ a newline */
|
||||
}
|
||||
|
||||
void
|
||||
soldump() /* Print out Solid record information */
|
||||
{
|
||||
register int i;
|
||||
|
||||
(void)printf("%c ", record.s.s_id ); /* S */
|
||||
(void)printf("%d ", record.s.s_type ); /* GED primitive type */
|
||||
(void)printf("%.16s ", name(record.s.s_name) ); /* unique name */
|
||||
(void)printf("%d ", record.s.s_cgtype );/* COMGEOM solid type */
|
||||
for( i = 0; i < 24; i++ )
|
||||
(void)printf("%.12e ", record.s.s_values[i] ); /* parameters */
|
||||
(void)printf("\n"); /* Terminate w/ a newline */
|
||||
}
|
||||
|
||||
void
|
||||
combdump() /* Print out Combination record information */
|
||||
{
|
||||
register int i;
|
||||
register int length; /* Keep track of number of members */
|
||||
int m1, m2; /* material property flags */
|
||||
|
||||
(void)printf("%c ", record.c.c_id ); /* C */
|
||||
if( record.c.c_flags == 'R' ) /* set region flag */
|
||||
(void)printf("Y "); /* Y if `R' */
|
||||
else
|
||||
(void)printf("N "); /* N if ` ' */
|
||||
(void)printf("%.16s ", name(record.c.c_name) ); /* unique name */
|
||||
(void)printf("%d ", record.c.c_regionid ); /* region ID code */
|
||||
(void)printf("%d ", record.c.c_aircode ); /* air space code */
|
||||
(void)printf("%d ", record.c.c_length ); /* # of members */
|
||||
(void)printf("%d ", record.c.c_num ); /* COMGEOM region # */
|
||||
(void)printf("%d ", record.c.c_material ); /* material code */
|
||||
(void)printf("%d ", record.c.c_los ); /* equiv. LOS est. */
|
||||
(void)printf("%d %d %d %d ",
|
||||
record.c.c_override,
|
||||
record.c.c_rgb[0],
|
||||
record.c.c_rgb[1],
|
||||
record.c.c_rgb[2] );
|
||||
m1 = m2 = 0;
|
||||
if( isascii(record.c.c_matname[0]) && isprint(record.c.c_matname[0]) ) {
|
||||
m1 = 1;
|
||||
if( record.c.c_matparm[0] )
|
||||
m2 = 1;
|
||||
}
|
||||
printf("%d %d ", m1, m2 );
|
||||
switch( record.c.c_inherit ) {
|
||||
case DB_INH_HIGHER:
|
||||
printf("%d ", DB_INH_HIGHER );
|
||||
break;
|
||||
default:
|
||||
case DB_INH_LOWER:
|
||||
printf("%d ", DB_INH_LOWER );
|
||||
break;
|
||||
}
|
||||
(void)printf("\n"); /* Terminate w/ a newline */
|
||||
|
||||
if( m1 )
|
||||
(void)printf("%.32s\n", CH(record.c.c_matname) );
|
||||
if( m2 )
|
||||
(void)printf("%.60s\n", CH(record.c.c_matparm) );
|
||||
|
||||
length = (int)record.c.c_length; /* Get # of member records */
|
||||
|
||||
for( i = 0; i < length; i++ ) {
|
||||
membdump();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
membdump() /* Print out Member record information */
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* Read in a member record for processing */
|
||||
(void)fread( (char *)&record, sizeof record, 1, stdin );
|
||||
(void)printf("%c ", record.M.m_id ); /* M */
|
||||
(void)printf("%c ", record.M.m_relation ); /* Boolean oper. */
|
||||
(void)printf("%.16s ", name(record.M.m_instname) ); /* referred-to obj. */
|
||||
for( i = 0; i < 16; i++ ) /* homogeneous transform matrix */
|
||||
(void)printf("%.12e ", record.M.m_mat[i] );
|
||||
(void)printf("%d ", record.M.m_num ); /* COMGEOM solid # */
|
||||
(void)printf("\n"); /* Terminate w/ nl */
|
||||
}
|
||||
|
||||
void
|
||||
arsadump() /* Print out ARS record information */
|
||||
{
|
||||
register int i;
|
||||
register int length; /* Keep track of number of ARS B records */
|
||||
|
||||
(void)printf("%c ", record.a.a_id ); /* A */
|
||||
(void)printf("%d ", record.a.a_type ); /* primitive type */
|
||||
(void)printf("%.16s ", name(record.a.a_name) ); /* unique name */
|
||||
(void)printf("%d ", record.a.a_m ); /* # of curves */
|
||||
(void)printf("%d ", record.a.a_n ); /* # of points per curve */
|
||||
(void)printf("%d ", record.a.a_curlen );/* # of granules per curve */
|
||||
(void)printf("%d ", record.a.a_totlen );/* # of granules for ARS */
|
||||
(void)printf("%.12e ", record.a.a_xmax ); /* max x coordinate */
|
||||
(void)printf("%.12e ", record.a.a_xmin ); /* min x coordinate */
|
||||
(void)printf("%.12e ", record.a.a_ymax ); /* max y coordinate */
|
||||
(void)printf("%.12e ", record.a.a_ymin ); /* min y coordinate */
|
||||
(void)printf("%.12e ", record.a.a_zmax ); /* max z coordinate */
|
||||
(void)printf("%.12e ", record.a.a_zmin ); /* min z coordinate */
|
||||
(void)printf("\n"); /* Terminate w/ a newline */
|
||||
|
||||
length = (int)record.a.a_totlen; /* Get # of ARS B records */
|
||||
|
||||
for( i = 0; i < length; i++ ) {
|
||||
arsbdump();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
arsbdump() /* Print out ARS B record information */
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* Read in a member record for processing */
|
||||
(void)fread( (char *)&record, sizeof record, 1, stdin );
|
||||
(void)printf("%c ", record.b.b_id ); /* B */
|
||||
(void)printf("%d ", record.b.b_type ); /* primitive type */
|
||||
(void)printf("%d ", record.b.b_n ); /* current curve # */
|
||||
(void)printf("%d ", record.b.b_ngranule ); /* current granule */
|
||||
for( i = 0; i < 24; i++ ) { /* [8*3] vectors */
|
||||
(void)printf("%.12e ", record.b.b_values[i] );
|
||||
}
|
||||
(void)printf("\n"); /* Terminate w/ a newline */
|
||||
}
|
||||
|
||||
void
|
||||
materdump() /* Print out material description record information */
|
||||
{
|
||||
(void)printf( "%c %d %d %d %d %d %d\n",
|
||||
record.md.md_id, /* m */
|
||||
record.md.md_flags, /* UNUSED */
|
||||
record.md.md_low, /* low end of region IDs affected */
|
||||
record.md.md_hi, /* high end of region IDs affected */
|
||||
record.md.md_r,
|
||||
record.md.md_g, /* color of regions: 0..255 */
|
||||
record.md.md_b );
|
||||
}
|
||||
|
||||
void
|
||||
bspldump() /* Print out B-spline solid description record information */
|
||||
{
|
||||
(void)printf( "%c %.16s %d %.12e\n",
|
||||
record.B.B_id, /* b */
|
||||
name(record.B.B_name), /* unique name */
|
||||
record.B.B_nsurf, /* # of surfaces in this solid */
|
||||
record.B.B_resolution ); /* resolution of flatness */
|
||||
}
|
||||
|
||||
void
|
||||
bsurfdump() /* Print d-spline surface description record information */
|
||||
{
|
||||
register int i;
|
||||
register float *vp;
|
||||
int nbytes, count;
|
||||
float *fp;
|
||||
|
||||
(void)printf( "%c %d %d %d %d %d %d %d %d %d\n",
|
||||
record.d.d_id, /* D */
|
||||
record.d.d_order[0], /* order of u and v directions */
|
||||
record.d.d_order[1], /* order of u and v directions */
|
||||
record.d.d_kv_size[0], /* knot vector size (u and v) */
|
||||
record.d.d_kv_size[1], /* knot vector size (u and v) */
|
||||
record.d.d_ctl_size[0], /* control mesh size (u and v) */
|
||||
record.d.d_ctl_size[1], /* control mesh size (u and v) */
|
||||
record.d.d_geom_type, /* geom type 3 or 4 */
|
||||
record.d.d_nknots, /* # granules of knots */
|
||||
record.d.d_nctls ); /* # granules of ctls */
|
||||
/*
|
||||
* The b_surf_head record is followed by
|
||||
* d_nknots granules of knot vectors (first u, then v),
|
||||
* and then by d_nctls granules of control mesh information.
|
||||
* Note that neither of these have an ID field!
|
||||
*
|
||||
* B-spline surface record, followed by
|
||||
* d_kv_size[0] floats,
|
||||
* d_kv_size[1] floats,
|
||||
* padded to d_nknots granules, followed by
|
||||
* ctl_size[0]*ctl_size[1]*geom_type floats,
|
||||
* padded to d_nctls granules.
|
||||
*
|
||||
* IMPORTANT NOTE: granule == sizeof(union record)
|
||||
*/
|
||||
|
||||
/* Malloc and clear memory for the KNOT DATA and read it */
|
||||
nbytes = record.d.d_nknots * sizeof(union record);
|
||||
if( (vp = (float *)malloc(nbytes)) == (float *)0 ) {
|
||||
(void)fprintf(stderr, "g2asc: spline knot malloc error\n");
|
||||
exit(1);
|
||||
}
|
||||
fp = vp;
|
||||
(void)bzero( (char *)fp, nbytes );
|
||||
count = fread( (char *)fp, 1, nbytes, stdin );
|
||||
if( count != nbytes ) {
|
||||
(void)fprintf(stderr, "g2asc: spline knot read failure\n");
|
||||
exit(1);
|
||||
}
|
||||
/* Print the knot vector information */
|
||||
count = record.d.d_kv_size[0] + record.d.d_kv_size[1];
|
||||
for( i = 0; i < count; i++ ) {
|
||||
(void)printf("%.12e\n", *vp++);
|
||||
}
|
||||
/* Free the knot data memory */
|
||||
(void)free( (char *)fp );
|
||||
|
||||
/* Malloc and clear memory for the CONTROL MESH data and read it */
|
||||
nbytes = record.d.d_nctls * sizeof(union record);
|
||||
if( (vp = (float *)malloc(nbytes)) == (float *)0 ) {
|
||||
(void)fprintf(stderr, "g2asc: control mesh malloc error\n");
|
||||
exit(1);
|
||||
}
|
||||
fp = vp;
|
||||
(void)bzero( (char *)fp, nbytes );
|
||||
count = fread( (char *)fp, 1, nbytes, stdin );
|
||||
if( count != nbytes ) {
|
||||
(void)fprintf(stderr, "g2asc: control mesh read failure\n");
|
||||
exit(1);
|
||||
}
|
||||
/* Print the control mesh information */
|
||||
count = record.d.d_ctl_size[0] * record.d.d_ctl_size[1] *
|
||||
record.d.d_geom_type;
|
||||
for( i = 0; i < count; i++ ) {
|
||||
(void)printf("%.12e\n", *vp++);
|
||||
}
|
||||
/* Free the control mesh memory */
|
||||
(void)free( (char *)fp );
|
||||
}
|
||||
|
||||
#ifdef SYSV
|
||||
|
||||
bzero( str, n )
|
||||
register char *str;
|
||||
register int n;
|
||||
{
|
||||
while( n-- > 0 )
|
||||
*str++ = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* N A M E
|
||||
*
|
||||
* Take a database name and null-terminate it,
|
||||
* converting unprintable characters to something printable.
|
||||
* Here we deal with NAMESIZE long names not being null-terminated.
|
||||
*/
|
||||
char *name( str )
|
||||
char *str;
|
||||
{
|
||||
static char buf[NAMESIZE+2];
|
||||
register char *ip = str;
|
||||
register char *op = buf;
|
||||
register int warn = 0;
|
||||
|
||||
while( op < &buf[NAMESIZE] ) {
|
||||
if( *ip == '\0' ) break;
|
||||
if( isascii(*ip) && isprint(*ip) && !isspace(*ip) ) {
|
||||
*op++ = *ip++;
|
||||
} else {
|
||||
*op++ = '@';
|
||||
ip++;
|
||||
warn = 1;
|
||||
}
|
||||
}
|
||||
*op = '\0';
|
||||
if(warn) {
|
||||
(void)fprintf(stderr,
|
||||
"g2asc: Illegal char in object name, converted to '%s'\n",
|
||||
buf );
|
||||
}
|
||||
if( op == buf ) {
|
||||
/* Null input name */
|
||||
(void)fprintf(stderr,
|
||||
"g2asc: NULL object name converted to -=NULL=-\n");
|
||||
return("-=NULL=-");
|
||||
}
|
||||
return(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* S T R C H O P
|
||||
*
|
||||
* Take a string and a length, and null terminate,
|
||||
* converting unprintable characters to something printable.
|
||||
*/
|
||||
char *strchop( str, len )
|
||||
char *str;
|
||||
{
|
||||
static char buf[1024];
|
||||
register char *ip = str;
|
||||
register char *op = buf;
|
||||
register int warn = 0;
|
||||
char *ep;
|
||||
|
||||
if( len > sizeof(buf)-2 ) len=sizeof(buf)-2;
|
||||
ep = &buf[len-1]; /* Leave room for null */
|
||||
while( op < ep ) {
|
||||
if( *ip == '\0' ) break;
|
||||
if( isascii(*ip) && (isprint(*ip) || isspace(*ip)) ) {
|
||||
*op++ = *ip++;
|
||||
} else {
|
||||
*op++ = '@';
|
||||
ip++;
|
||||
warn = 1;
|
||||
}
|
||||
}
|
||||
*op = '\0';
|
||||
if(warn) {
|
||||
(void)fprintf(stderr,
|
||||
"g2asc: Illegal char in string, converted to '%s'\n",
|
||||
buf );
|
||||
}
|
||||
if( op == buf ) {
|
||||
/* Null input name */
|
||||
(void)fprintf(stderr,
|
||||
"g2asc: NULL string converted to -=STRING=-\n");
|
||||
return("-=STRING=-");
|
||||
}
|
||||
return(buf);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
.TH PIX2ASC 1 BRL/CAD
|
||||
.SH NAME
|
||||
pix2asc,
|
||||
asc2pix \- encode and decode color pixel files
|
||||
.SH SYNOPSIS
|
||||
.B pix2asc
|
||||
< file.pix > file.a_pix
|
||||
.br
|
||||
.B asc2pix
|
||||
< file.a_pix > file.pix
|
||||
.SH DESCRIPTION
|
||||
.I Pix2asc
|
||||
and
|
||||
.I asc2pix
|
||||
are simple filters which convert color
|
||||
.IR pix (5)
|
||||
files from their binary form to a portable ASCII form, and back.
|
||||
.I Pix2asc
|
||||
reads the binary file on standard in and writes ASCII on standard out.
|
||||
.I Asc2pix
|
||||
does the reverse.
|
||||
.PP
|
||||
The binary file consists of a sequence
|
||||
of three-tuples of
|
||||
.B unsigned chars
|
||||
representing the
|
||||
red, green, and blue intensities for each pixel.
|
||||
The ASCII version of the file has
|
||||
one RGB pixel per newline-terminated line, with each
|
||||
pixel represented as six hexadecimal digits.
|
||||
.PP
|
||||
When moving
|
||||
.IR pix (5)
|
||||
files between UNIX systems
|
||||
via tape (see
|
||||
.IR tar (1)
|
||||
and
|
||||
.IR cpio (1))
|
||||
or via network (see
|
||||
.IR rcp (1)
|
||||
and
|
||||
.IR ftp (1)),
|
||||
this conversion to ASCII is unnecessary,
|
||||
as all UNIX files are byte streams, regardless of the underlying hardware.
|
||||
However, when transporting images to non-UNIX machines,
|
||||
these tools are invaluable.
|
||||
Note that
|
||||
.IR rt (1)
|
||||
can directly generate the ASCII form of an image file using the
|
||||
.B \-O
|
||||
flag, allowing it to be easily used on non-UNIX systems.
|
||||
.SH SEE ALSO
|
||||
brlcad(1), pix(5)
|
||||
.SH AUTHOR
|
||||
Michael John Muuss
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@BRL.MIL>.
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* P I X 2 A S C . C
|
||||
*
|
||||
* Author -
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned char pix[3]; /* RGB of one pixel */
|
||||
|
||||
char map[18] = "0123456789ABCDEFx";
|
||||
|
||||
main()
|
||||
{
|
||||
while( !feof(stdin) &&
|
||||
fread( (char *)pix, sizeof(pix), 1, stdin) == 1 ) {
|
||||
putc( map[pix[0]>>4], stdout );
|
||||
putc( map[pix[0]&0xF], stdout );
|
||||
putc( map[pix[1]>>4], stdout );
|
||||
putc( map[pix[1]&0xF], stdout );
|
||||
putc( map[pix[2]>>4], stdout );
|
||||
putc( map[pix[2]&0xF], stdout );
|
||||
putc( '\n', stdout );
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* db/Cakefile
|
||||
*
|
||||
* This Cakefile is for a recipient machine.
|
||||
* The function is to take the distributed .asc files, and
|
||||
* create the local binary form in .g files.
|
||||
*
|
||||
* The STATIC_PRODUCTS definition will cause special things to
|
||||
* happen in the "inst-dist" rule, so that the ASCII files
|
||||
* get into the distribution directory.
|
||||
* What is still missing is some automation to generate the
|
||||
* .asc files from updated binary .g files on the master machine,
|
||||
* but of course, it is hard to know which directory to look in,
|
||||
* so for now this will remain a manual process.
|
||||
*/
|
||||
|
||||
#define PRODUCTS bldg391.g crod.g demo.g \
|
||||
ktank.g moss.g prim.g \
|
||||
star.g truck.g world.g cube.g axis.g \
|
||||
woodsman.g m35.g lgt-test.g
|
||||
#define STATIC_PRODUCTS bldg391.asc crod.asc demo.asc \
|
||||
ktank.asc moss.asc prim.asc \
|
||||
star.asc truck.asc world.asc cube.asc axis.asc \
|
||||
woodsman.asc m35.asc \
|
||||
lgt-test.asc lgt-test.ldb lgt-test.mdb lgt-test.key
|
||||
|
||||
#define SRCDIR db
|
||||
#define FILES /**/
|
||||
#define SRCSUFF .asc
|
||||
#define MANSECTION 9
|
||||
|
||||
#include "../Cakefile.defs"
|
||||
|
||||
/* Prevent actual installation */
|
||||
#define DONT_INSTALL 1
|
||||
#undef BINDIR
|
||||
#define BINDIR /tmp
|
||||
#define AFTERINSTALL rm
|
||||
|
||||
/* Default rule */
|
||||
everything&:: PRODUCTS
|
||||
|
||||
#if defined(NFS)
|
||||
# define CONV ../.conv.MTYPE/asc2g
|
||||
#else
|
||||
# define CONV ../conv/asc2g
|
||||
#endif
|
||||
|
||||
%.g: ../SRCDIR/%.asc if exist ../SRCDIR/%.asc
|
||||
CONV < ../SRCDIR/%.asc > %.g
|
||||
|
||||
#include "../Cakefile.rules"
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
#
|
||||
# db/Makefile
|
||||
# This Makefile only used for preparing the distribution!
|
||||
# We assume that the .g files are fine, and merely work on the .asc ones.
|
||||
#
|
||||
.SUFFIXES: .g .asc
|
||||
|
||||
PRODUCTS = bldg391.asc crod.asc demo.asc ktank.asc moss.asc prim.asc \
|
||||
star.asc truck.asc world.asc cube.asc axis.asc
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
DISTDIR = /m/dist/db
|
||||
|
||||
##.asc.g: ; $(A2G) < $? > $@
|
||||
|
||||
A2G = asc2g
|
||||
G2A = g2asc
|
||||
|
||||
all: ${PRODUCTS}
|
||||
|
||||
dist: ${PRODUCTS}
|
||||
|
||||
bldg391.asc: bldg391.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
crod.asc: crod.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
demo.asc: demo.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
ktank.asc: ktank.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
moss.asc: moss.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
prim.asc: prim.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
star.asc: star.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
truck.asc: truck.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
world.asc: world.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
cube.asc: cube.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
axis.asc: axis.g
|
||||
-mv -f $*.asc $*.asc.bak; $(G2A) < $? > $*.asc ; chmod 444 $*.asc
|
||||
|
||||
depend:
|
||||
echo "db: depend"
|
||||
|
||||
install: ${PRODUCTS}
|
||||
-@sh -c "if test `hostname` = brl-vgr ; then make inst-dist; else exit 0 ; fi"
|
||||
|
||||
inst-dist: ${PRODUCTS}
|
||||
-rm -fr ${DISTDIR}/*
|
||||
-cp Makefile.dist ${DISTDIR}/Makefile
|
||||
-@for prod in ${PRODUCTS} ; \
|
||||
do if cmp -s ${DISTDIR}/$$prod $$prod; \
|
||||
then echo $$prod unchanged; \
|
||||
else rm -f ${DISTDIR}/$$prod 2>/dev/null; \
|
||||
cp $$prod ${DISTDIR} && \
|
||||
echo "++++++INSTALLED" ${DISTDIR}/$$prod && \
|
||||
chmod 444 ${DISTDIR}/$$prod; \
|
||||
fi \
|
||||
done
|
||||
|
||||
clean:
|
||||
echo "db: cleaned"
|
||||
|
||||
clobber:
|
||||
echo "db: clobber ignored"
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Build the binary versions from the ASCII versions
|
||||
# This Makefile for recipients of the distribution.
|
||||
#
|
||||
.SUFFIXES: .g .asc
|
||||
|
||||
.asc.g: ; $(A2G) < $< > $@
|
||||
|
||||
A2G=../conv/asc2g
|
||||
G2A=../conv/g2asc
|
||||
|
||||
all: bldg391.g crod.g demo.g ktank.g moss.g prim.g \
|
||||
star.g truck.g world.g cube.g axis.g
|
||||
|
||||
clean:
|
||||
echo "db: clean"
|
||||
|
||||
clobber:
|
||||
rm -f *.g
|
||||
|
||||
depend:
|
||||
echo "db: depend"
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
I 0 v4
|
||||
Gary Moss's "World on a Platter"
|
||||
S 16 tor 6 4.916235923767e+00 -3.280223083496e+01 3.171177673340e+01 0.000000000000e+00 5.079999923706e+00 0.000000000000e+00 -1.796051025391e+01 0.000000000000e+00 1.796051025391e+01 -1.796051025391e+01 0.000000000000e+00 -1.796051025391e+01 -1.436841011047e+01 0.000000000000e+00 1.436841011047e+01 -1.436840915680e+01 0.000000000000e+00 -1.436840915680e+01 -2.155261230469e+01 0.000000000000e+00 2.155261230469e+01 -2.155261230469e+01 0.000000000000e+00 -2.155261230469e+01
|
||||
S 20 platform.s 1 8.971723937988e+01 -6.957164001465e+01 -2.376846313477e+01 0.000000000000e+00 1.390160369873e+02 0.000000000000e+00 0.000000000000e+00 1.390160369873e+02 6.950803756714e+00 0.000000000000e+00 0.000000000000e+00 6.950803756714e+00 -1.390160369873e+02 0.000000000000e+00 0.000000000000e+00 -1.390160369873e+02 1.390160369873e+02 0.000000000000e+00 -1.390160369873e+02 1.390160369873e+02 6.950803756714e+00 -1.390160369873e+02 0.000000000000e+00 6.950803756714e+00
|
||||
S 20 box.s 1 3.002833557129e+01 -5.211529731750e+00 -1.637908935547e+01 0.000000000000e+00 2.679275512695e+01 0.000000000000e+00 0.000000000000e+00 2.679275512695e+01 2.679275512695e+01 0.000000000000e+00 0.000000000000e+00 2.679275512695e+01 -2.679275512695e+01 0.000000000000e+00 0.000000000000e+00 -2.679275512695e+01 2.679275512695e+01 0.000000000000e+00 -2.679275512695e+01 2.679275512695e+01 2.679275512695e+01 -2.679275512695e+01 0.000000000000e+00 2.679275512695e+01
|
||||
S 18 cone.s 5 1.687542724609e+01 -3.474353027344e+01 -1.637908935547e+01 0.000000000000e+00 0.000000000000e+00 2.644671630859e+01 9.350327491760e+00 -9.350327491760e+00 0.000000000000e+00 9.350327491760e+00 9.350327491760e+00 0.000000000000e+00 4.339659690857e+00 -4.339659690857e+00 0.000000000000e+00 1.453863143921e+00 1.453863143921e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 ellipse.s 4 1.613092041016e+01 4.665559387207e+01 -3.722520828247e+00 1.487607192993e+01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 8.980256080627e+00 -8.980256080627e+00 0.000000000000e+00 8.980256080627e+00 8.980256080627e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
C Y platform.r 1000 0 1 -16081 0 0 1 80 150 230 0 0 0
|
||||
M + platform.s 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 16268
|
||||
C Y box.r 2000 0 1 -16558 0 0 1 100 190 190 0 0 0
|
||||
M + box.s 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 16519
|
||||
C Y ellipse.r 4000 0 1 16619 0 0 1 100 210 100 0 0 0
|
||||
M + ellipse.s 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C Y cone.r 3000 0 1 -16209 0 0 1 255 100 255 0 0 0
|
||||
M + cone.s 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C Y tor.r 6000 0 1 -16219 0 0 1 240 240 0 0 0 0
|
||||
M + tor 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 16473
|
||||
S 19 LIGHT 11 2.015756225586e+01 -1.352595329285e+01 5.034742355347e+00 2.539999961853e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.539999961853e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.539999961853e+00 6.652935973394e-32 -1.768683290104e-12 -4.437394240169e-21 0.000000000000e+00 -5.077455353676e-19 -2.153920654297e+03 0.000000000000e+00 0.000000000000e+00 -5.077455353676e-19 -5.400174699785e-19 0.000000000000e+00 0.000000000000e+00
|
||||
C Y light.r 1000 0 1 0 1 100 1 255 255 255 1 0 0
|
||||
light
|
||||
M u LIGHT 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C N all.g -1 0 6 16619 0 0 0 0 0 0 0 0 0
|
||||
M u platform.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u box.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 -2.369892883301e+01 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 1.340998744965e+01 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 8.023991584778e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u cone.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.204924011230e+01 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 1.223486709595e+01 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 2.111249841619e-07 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u ellipse.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.467929267883e+01 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 -4.160771179199e+01 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 3.879878234863e+01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u tor.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u light.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
@@ -1,48 +0,0 @@
|
||||
I 1 v4
|
||||
A Tin Woodsman
|
||||
S 20 solid8 1 1.000000000000e+00 -1.000000000000e+00 -1.000000000000e+00 0.000000000000e+00 2.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.000000000000e+00 2.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.000000000000e+00 -2.000000000000e+00 0.000000000000e+00 0.000000000000e+00 -2.000000000000e+00 2.000000000000e+00 0.000000000000e+00 -2.000000000000e+00 2.000000000000e+00 2.000000000000e+00 -2.000000000000e+00 0.000000000000e+00 2.000000000000e+00
|
||||
S 16 torus 16 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.000000029802e-01 0.000000000000e+00 -7.071067690849e-01 0.000000000000e+00 7.071067690849e-01 -7.071067690849e-01 0.000000000000e+00 -7.071067690849e-01 -5.656854510307e-01 0.000000000000e+00 5.656854510307e-01 -5.656854510307e-01 0.000000000000e+00 -5.656854510307e-01 -8.485281467438e-01 0.000000000000e+00 8.485281467438e-01 -8.485281467438e-01 0.000000000000e+00 -8.485281467438e-01
|
||||
S 19 ellipsoid 23 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 5.000000000000e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 5.000000000000e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 18 cylinder 12 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 7.071067690849e-01 -7.071067690849e-01 0.000000000000e+00 7.071067690849e-01 7.071067690849e-01 0.000000000000e+00 7.071067690849e-01 -7.071067690849e-01 0.000000000000e+00 7.071067690849e-01 7.071067690849e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.1 11 0.000000000000e+00 2.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.2 23 -1.299999952316e+00 0.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -1.767766922712e-01 1.530800293925e-17 1.767766922712e-01 1.767766922712e-01 0.000000000000e+00 1.767766922712e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.6 23 -5.000000000000e-01 -3.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -3.535533845425e-01 3.061600587851e-17 3.535533845425e-01 3.535533845425e-01 0.000000000000e+00 3.535533845425e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 18 c.1 12 0.000000000000e+00 2.200000047684e+00 0.000000000000e+00 8.659514281312e-17 2.000000000000e+00 -8.659514281312e-17 -1.000000000000e+00 4.329757140656e-17 -1.665334536938e-16 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -1.000000014901e-01 4.329756975220e-18 -1.665334603112e-17 0.000000000000e+00 4.329757388810e-18 1.000000014901e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 20 s.1 8 1.000000000000e+00 -2.000000000000e+00 -1.000000000000e+00 0.000000000000e+00 3.000000000000e+00 0.000000000000e+00 0.000000000000e+00 3.000000000000e+00 2.000000000000e+00 0.000000000000e+00 0.000000000000e+00 2.000000000000e+00 -2.000000000000e+00 0.000000000000e+00 0.000000000000e+00 -2.000000000000e+00 3.000000000000e+00 0.000000000000e+00 -2.000000000000e+00 3.000000000000e+00 2.000000000000e+00 -2.000000000000e+00 0.000000000000e+00 2.000000000000e+00
|
||||
S 16 t.1 16 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000014901e-01 0.000000000000e+00 -7.071067690849e-01 0.000000000000e+00 7.071067690849e-01 -7.071067690849e-01 0.000000000000e+00 -7.071067690849e-01 -6.363961100578e-01 0.000000000000e+00 6.363961100578e-01 -6.363961100578e-01 0.000000000000e+00 -6.363961100578e-01 -7.778174281120e-01 0.000000000000e+00 7.778174281120e-01 -7.778174281120e-01 0.000000000000e+00 -7.778174281120e-01
|
||||
S 18 c.2 12 0.000000000000e+00 4.199999809265e+00 0.000000000000e+00 8.659514281312e-17 2.000000000000e+00 -8.659514281312e-17 -1.000000014901e-01 4.329756975220e-18 -1.665334603112e-17 0.000000000000e+00 4.329757388810e-18 1.000000014901e-01 -1.000000014901e-01 4.329756975220e-18 -1.665334603112e-17 0.000000000000e+00 4.329757388810e-18 1.000000014901e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.3 23 -1.299999952316e+00 -2.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -1.767766922712e-01 1.530800293925e-17 1.767766922712e-01 1.767766922712e-01 0.000000000000e+00 1.767766922712e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.4 23 1.299999952316e+00 0.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -1.767766922712e-01 1.530800293925e-17 1.767766922712e-01 1.767766922712e-01 0.000000000000e+00 1.767766922712e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.5 23 1.299999952316e+00 -2.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -1.767766922712e-01 1.530800293925e-17 1.767766922712e-01 1.767766922712e-01 0.000000000000e+00 1.767766922712e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.7 23 -5.000000000000e-01 -5.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -3.535533845425e-01 3.061600587851e-17 3.535533845425e-01 3.535533845425e-01 0.000000000000e+00 3.535533845425e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.8 23 5.000000000000e-01 -3.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -3.535533845425e-01 3.061600587851e-17 3.535533845425e-01 3.535533845425e-01 0.000000000000e+00 3.535533845425e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
S 19 e.9 23 5.000000000000e-01 -5.000000000000e+00 0.000000000000e+00 4.329757140656e-17 1.000000000000e+00 -4.329757140656e-17 -3.535533845425e-01 3.061600587851e-17 3.535533845425e-01 3.535533845425e-01 0.000000000000e+00 3.535533845425e-01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
|
||||
C Y torso.r 1000 0 1 0 1 100 1 95 159 159 1 0 0
|
||||
plastic
|
||||
M u s.1 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C Y collar.r 1002 0 1 73 1 100 1 255 127 0 1 0 0
|
||||
plastic
|
||||
M u t.1 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C Y limbs.r 1001 0 9 4096 1 100 1 255 200 160 1 0 0
|
||||
plastic
|
||||
M u e.1 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.2 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.3 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.4 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.5 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.6 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.7 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.8 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u e.9 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C Y funnel.r 1004 0 4 4096 1 100 1 35 107 142 1 1 0
|
||||
plastic
|
||||
sh=100
|
||||
M u c.1 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M - e.1 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u c.2 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M - e.1 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
C N man.g -1 0 4 0 0 0 0 0 16 1 0 0 0
|
||||
M u collar.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u funnel.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u limbs.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
M u torso.r 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* doc/Cakefile
|
||||
*/
|
||||
#include "../Cakefile.defs"
|
||||
|
||||
#define PRODUCTS /**/
|
||||
#define SRCDIR doc
|
||||
#define FILES /**/
|
||||
#define SRCSUFF .doc
|
||||
#define MANSECTION 5
|
||||
|
||||
/*
|
||||
* There is nothing to compile. The "inst-dist" rules should take
|
||||
* all the documents and send them to distribution directory,
|
||||
* on the master machine. Otherwise, do nothing.
|
||||
*/
|
||||
|
||||
all&:
|
||||
@echo "doc: all done"
|
||||
|
||||
#include "../Cakefile.rules"
|
||||
@@ -1,578 +0,0 @@
|
||||
.\" $Header$
|
||||
.\" tbl benchmark.doc | troff -t -ms | ...
|
||||
.TL
|
||||
The BRL-CAD Benchmark Test
|
||||
.AU
|
||||
Michael John Muuss
|
||||
.AU
|
||||
Charles M. Kennedy
|
||||
.AI
|
||||
The Ballistic Research Laboratory
|
||||
.PP
|
||||
This document describes the BRL-CAD Benchmark Test Methodology,
|
||||
and the Ray-Tracing Figure of Merit (RTFM) used to judge the
|
||||
computational performance of different computer systems.
|
||||
.PP
|
||||
The core of the test is the \fBrt\fR ray-tracing program.
|
||||
The results for each processor are determined by
|
||||
running a benchmark test of the RT ray-tracing program on each of the sample
|
||||
databases provided.
|
||||
The \fBrt\fR program requires a binary database for input ("db/xxx.g"), and
|
||||
produces a binary image as output ("bench/xxx.pix"), along with a log
|
||||
file ("bench/xxx.log").
|
||||
Each run will produce a 512x512x24 bit color
|
||||
shaded image in a "bench/xxx.pix" file, and a run log in "bench/xxx.log".
|
||||
Reference copies of the images are provided as "pix/xxx.pix" and
|
||||
"pix/xxx.log". The sample databases provided are processed in
|
||||
order of increasing difficulty, and each produces a colorful image. In
|
||||
each picture there are two light sources; the primary source is located
|
||||
near the center of the model (the white ball), and the secondary light
|
||||
source is located at the "eye" position.
|
||||
.NH 1
|
||||
The Benchmark Models
|
||||
.LP
|
||||
moss.g -- This is a simple model, containing a yellow torus,
|
||||
a green ellipsoid, a bluish cube, a pink truncated (distorted) cone,
|
||||
all sitting on a blue plate. Note the shadowing, and "specular splash".
|
||||
.sp
|
||||
world.g -- The same model as moss.g, but with various rendering
|
||||
features enabled. The model is enclosed in a hollow cloud sphere.
|
||||
The plate is a mirror, the egg is crystal, the box has a debugging
|
||||
texture map applied.
|
||||
.sp
|
||||
star.g -- A familiar sight to Star Trek fans; a low-detail exterior
|
||||
of the ship "Enterprise". The hull is white, with some other structures
|
||||
in other colors. The small red object in the foreground is the
|
||||
shuttlecraft Galileo, to scale.
|
||||
.sp
|
||||
bldg391.g -- An exploded view of a two-story imaginary computer site,
|
||||
including various walls, red stairways, green disk drives, etc.
|
||||
The lower floor is a mirror, the upper floor is glass.
|
||||
.NH 1
|
||||
MACHINE INDEPENDENCE
|
||||
.PP
|
||||
To make the benchmark
|
||||
distribution machine independent,
|
||||
the databases are provided
|
||||
in an ASCII format in the "db" directory, and
|
||||
ascii-to-binary converters are provided in the "conv" directory.
|
||||
The setup command "\fBcake benchmark\fR"
|
||||
(see the document \fIInstalling the BRL-CAD Package\fR)
|
||||
will automatically compile and run the converters.
|
||||
.PP
|
||||
If you are running this
|
||||
benchmark on a non-UNIX machine that has difficulty writing binary
|
||||
streams, change the "-o file.pix" flag to "-O file.a_pix" and RT
|
||||
will write an ASCII form directly. For more discussion, consult
|
||||
the doc/pix.5 and conv/asc2pix.1 manual pages.
|
||||
.PP
|
||||
The reference images are distributed in binary BRL-CAD
|
||||
.BR pix (5)
|
||||
format.
|
||||
Earlier releases distributed the reference images in the portable
|
||||
ASCII form, and then converted them to the binary form.
|
||||
This consumed a significant amount of extra storage on UNIX machines,
|
||||
so this practice was discontinued.
|
||||
It is assumed that anyone attempting to benchmark a system that
|
||||
can not read pure binary files will at least have access to a
|
||||
UNIX system.
|
||||
That UNIX system can be used to convert the reference images to
|
||||
the portable ASCII form with the
|
||||
.BR pix2asc (1)
|
||||
tool, and then those images may be sent to the machine under test.
|
||||
.PP
|
||||
Information about modifying the benchmark to run on a particular system
|
||||
may be found in the document \fIInstalling the BRL-CAD Package\fR.
|
||||
For a detailed explanation of various hardware specific modifications
|
||||
necessary to take advantage of parallel processing, see the document
|
||||
\fIWorkstations, Networking, Distributed Graphics, and
|
||||
Parallel Processing\fR.
|
||||
Implementations for several different types of hardware in use at BRL
|
||||
are included.
|
||||
.PP
|
||||
If you encounter difficulty
|
||||
with running the benchmark,
|
||||
you might wish to build the full BRL-CAD package, to
|
||||
take advantage of the image tools in determining the nature of the problem.
|
||||
For example, one system suffered from a compiler bug that made
|
||||
TGC solids vanish, while another system had difficulties with
|
||||
the light visibility calculations.
|
||||
.NH 1
|
||||
OBTAINING CORRECT RESULTS
|
||||
.PP
|
||||
The benchmark timings are not considered valid unless
|
||||
the correct results are given.
|
||||
Make sure that the answers match the reference files
|
||||
to within plus-or-minus one in each color (see pixdiff(1)).
|
||||
Slight variations in the calculated pixels are generally attributable
|
||||
to variations in floating point precision.
|
||||
You may wish to
|
||||
compare the execution times and log file remarks
|
||||
from your tests (in the "bench/xxx.log" files) with the
|
||||
VAX-11/780 (with hardware FPA) times which are given in the
|
||||
"pix/xxx.log" files.
|
||||
The reference images are also located in the "pix/" directory.
|
||||
.PP
|
||||
For example,
|
||||
if you are running the benchmark on a Cray XMP,
|
||||
the world.pix and bldg391.pix images will have a single byte in the
|
||||
blue channel off by 1, out in the cloud background. This is not to be
|
||||
considered an error.
|
||||
.NH 1
|
||||
BENCHMARK IMAGE DISPLAY
|
||||
.PP
|
||||
If you have a suitable framebuffer,
|
||||
you may wish to
|
||||
display the images generated by the benchmark, and compare them
|
||||
to the reference images.
|
||||
This section assumes that you have successfully compiled the
|
||||
full set of BRL-CAD software, not just the benchmark portion.
|
||||
Programs for dealing with images are in the "util" directory.
|
||||
To display a \fBpix\fR(5)
|
||||
file on a framebuffer, set environment variable FB_FILE
|
||||
(see \fBbrlcad\fR(1)
|
||||
for details), and run \fBpix-fb\fR. Note that by leaving
|
||||
FB_FILE unset, your default display will be used.
|
||||
.sp
|
||||
.nf
|
||||
.ft B
|
||||
cd bench
|
||||
pix-fb moss.pix
|
||||
.ft R
|
||||
.fi
|
||||
.sp
|
||||
If the images computed on your machine do not match the reference images,
|
||||
the program "util/pixdiff" will compute a pix file that will highlight
|
||||
the differences for you, and report a summary of bytes equal, off-by-1,
|
||||
and off-by-many, e.g.,
|
||||
.sp
|
||||
.ft B
|
||||
pixdiff moss.pix ../pix/moss.pix \(or pix-fb
|
||||
.ft R
|
||||
.fi
|
||||
.sp
|
||||
For a display of the relative magnitude of the differences at
|
||||
each pixel, use "util/bwdiff" instead, e.g.,
|
||||
.sp
|
||||
.nf
|
||||
.ft B
|
||||
bwdiff moss.pix ../pix/moss.pix \(or pix-fb
|
||||
.ft R
|
||||
or
|
||||
.ft B
|
||||
bwdiff moss.pix ../pix/moss.pix \(or \\
|
||||
bwmod -s 128 -m 4 -a 128 \(or pix-fb
|
||||
.ft R
|
||||
.fi
|
||||
.sp
|
||||
and for statistics on the differences, use
|
||||
.sp
|
||||
.ft B
|
||||
bwdiff moss.pix ../pix/moss.pix \(or pixstat
|
||||
.ft R
|
||||
.NH 1
|
||||
THE COMPETITION
|
||||
.PP
|
||||
Here is the list of systems that have been tested so far,
|
||||
with as much information about the configuration as could be obtained.
|
||||
Some systems have a great many options for small things that can
|
||||
affect performance, such as memory interleaving.
|
||||
.LP
|
||||
.TS
|
||||
center box;
|
||||
l l.
|
||||
System Name Configuration
|
||||
_ _
|
||||
alliant Alliant FX/8 (8 CEs, 9 IPs, 64 Mbytes), Concentrix 3.0
|
||||
amsaa-seer Gould PN 9080, w/MACCs, UTX 2.0, 4x4Mb mem boards
|
||||
ardec-3 Pyramid 90Mx, Dual-CPU, OSx 2.5, 16 Mbytes
|
||||
bob.brl.mil Cray-2, SN 2009, 4.3ns clock
|
||||
brl-patton Cray X-MP/48, SN213, COS V115BF2, 8.5ns clock
|
||||
brl-spark Gould PN 9050, no MACC, UTX 2.0, 2x4Mb mem boards
|
||||
brl-sws2 Convex C120, 16 Mbytes, Convex Unix 6.2.32.2
|
||||
brl-vector Alliant FX/80 (8 ACEs, 6 IPs, 32 Mbytes), Concentrix
|
||||
brl-venom Alliant FX/8 (8 CEs, 6 IPs, 32 Mbytes), Concentrix
|
||||
brl-vgr VAX 780, FPA, 4.3 BSD
|
||||
brl-virus Sun-3/50, 15 Mhz clock, 12 Mhz 68881, Sun UNIX 3.2
|
||||
brl-vista SGI 3030, w/FP chip, UNIX release 3.5
|
||||
brl-vmb Gould PN 9080, no MACCs, UTX 2.0, 12x1Mb mem boards
|
||||
brl-vhs Silicon Graphics 4D/60T, 12.5 Mhz clock 8MB memory
|
||||
brl-voyage Silicon Graphics 4D/120, 16.7 Mhz clock 16 MB memory
|
||||
brl-taylor Silicon Graphics 4D/220, 25 Mhz clock 16 MB memory
|
||||
c1east T{
|
||||
Convex C1 XP (2 IOPs, 4 Multibus, 64 Mbytes),
|
||||
S/W 6.0.1.12
|
||||
T}
|
||||
elxsi-gnu Elxsi 6420, BSD 4.2 16 MB
|
||||
elxsi-gnuy Elxsi 6420, Sys Vr2, 16MB
|
||||
elxsi-m1 Elxsi 6410, BSD 4.2 16 MB
|
||||
hep Denelcor HEP, 4 PEMs
|
||||
indigo SGI Iris 3030, FPA, GL2-W3.5
|
||||
mseries T{
|
||||
MIPS Mseries, Release 0.6, UMIPS 2.1, 16 MB of R2350 RAM.
|
||||
R2000 CPU rev 5.0, R2010 FP rev 2.0
|
||||
T}
|
||||
multiflow Multiflow Trace 7/200 (PRELIMINARY)
|
||||
snm2 Cray 1-M, SN2, UNICOS 2.0
|
||||
tek4132 Tektronix 4132, 32082 fpp, UTek 2.3
|
||||
utah-gr VAX 785, FPA, 4.3 BSD
|
||||
utah-cs VAX 8600, FPA, 4.3 BSD
|
||||
violet VaxStationII GPX, Ultrix 1.2
|
||||
vortac Sun-3/160, 16.67 Mhz clock, 12 Mhz 68881, Sun 3.2
|
||||
.TE
|
||||
.NH 1
|
||||
BENCHMARK RESULTS
|
||||
.PP
|
||||
In the tradition of Dongarra, the Rays/sec figure is considered the
|
||||
"RT Figure of Merit" (RTFM). Note that the RTFM can only be compared
|
||||
between different runs on the \fIsame\fR database; it is not meaningful
|
||||
to compare RTFM numbers between different databases. The Rays/sec number
|
||||
for a multi-processor machine is for "aggregate CPU cluster seconds",
|
||||
rather than rays/total CPU seconds (which remains fairly constant on
|
||||
good parallel machines). Worthy finalists to date are listed below.
|
||||
Entries are omitted for tests in which correct results were not
|
||||
obtained.
|
||||
.PP
|
||||
The statistics are recorded in
|
||||
an easily understood format, with all results for
|
||||
a particular configuration listed on a single line.
|
||||
The numbers reported are the rays/sec (RTFM) figure.
|
||||
Entries denoted with a dagger ("\(dg") produced incorrect results.
|
||||
Entries denoted with a dash ("-") were not available and should be
|
||||
considered differently than those entries with a dagger.
|
||||
Generally the results are not available because time constraints
|
||||
prevented running the complete set of databases.
|
||||
.fi
|
||||
.NH 1
|
||||
RELEASE 1.20 STATISTICS (12-Feb-1987)
|
||||
.LP
|
||||
.TS H
|
||||
expand box;
|
||||
l l | n n n n | n | l.
|
||||
A/* H/W Moss World Star Bldg Mean S/W Notes
|
||||
_
|
||||
.TH
|
||||
Rays tek4132 80.5 44.0 33.9 31.4 ? UTek 2.3
|
||||
*vgr tek4132 0.72 0.69 0.62 0.62 ?
|
||||
_
|
||||
Rays violet 107.7 57.3 44.7 44.1 ? Ultrix 1.2
|
||||
*vgr violet 0.96 0.90 0.81 0.87 ?
|
||||
_
|
||||
Rays violet 119.0 63.0 50.0 46.3 ? Ultrix 1.2,
|
||||
*vgr violet 1.06 0.99 0.91 0.91 ? w/fast_sqrt
|
||||
_
|
||||
Rays vgr 112.1 63.6 55.0 50.7 ? BSD 4.3
|
||||
*vgr vgr 1.0 1.0 1.0 1.0 1.0
|
||||
_
|
||||
Rays indigo 115.9 85.3 \(dg 101.8 ? GL2-W3.5
|
||||
*vgr indigo 1.03 1.34 \(dg 2.01 ?
|
||||
_
|
||||
Rays vista 116.4 86.0 \(dg 102.3 ? SGI UNIX 3.5
|
||||
*vgr vista 1.04 1.35 \(dg 2.02 ?
|
||||
_
|
||||
Rays virus 127.3 69.9 57.0 52.4 ? Sun UNIX 3.2
|
||||
*vgr virus 1.14 1.10 1.04 1.03 ?
|
||||
_
|
||||
Rays vortac 148.2 81.0 65.8 60.7 ? Sun UNIX 3.2
|
||||
*vgr vortac 1.32 1.27 1.20 1.20 ?
|
||||
_
|
||||
Rays utah-gr 191.8 105.8 89.9 86.5 ? 4.3 BSD
|
||||
*vgr utah-gr 1.71 1.66 1.64 1.71 ?
|
||||
_
|
||||
Rays ardec-3 - 68.4 57.2 - ? OSx 2.5
|
||||
*vgr ardec-3 - 1.08 1.04 - ?
|
||||
_
|
||||
Rays elxsim1 380.5 232.2 204.8 189.3 ? BSD 4.2
|
||||
*vgr elxsim1 3.39 3.65 3.72 3.73 ?
|
||||
_
|
||||
Rays spark 413.4 232.0 213.8 211.9 ? UTX 2.0
|
||||
*vgr spark 3.69 3.65 3.89 4.18 ?
|
||||
_
|
||||
Rays vmb 413.9 233.4 210.6 212.6 ? UTX 2.0
|
||||
*vgr vmb 3.69 3.67 3.83 4.19 ?
|
||||
_
|
||||
Rays c1east 454.8 252.4 205.6 192.3 ? Convex UNIX 6.0.1.12,
|
||||
*vgr c1east 4.06 3.97 3.74 3.80 ? vanilla cc
|
||||
_
|
||||
Rays seer 460.7 263.2 246.8 241.0 ? UTX 2.0
|
||||
*vgr seer 4.11 4.14 4.49 4.75 ?
|
||||
_
|
||||
Rays venom 492.9 228.0 180.0 157.1 ? Concentrix 2.0
|
||||
*vgr venom 4.40 3.58 3.27 3.10 ?
|
||||
_
|
||||
Rays elxgnu 520.6 315.4 264.4 242.0 ? BSD 4.2
|
||||
*vgr elxgnu 4.64 4.96 4.81 4.77 ?
|
||||
_
|
||||
Rays utah-cs 521.1 292.1 237.4 216.2 ? BSD 4.3
|
||||
*vgr utah-cs 4.64 4.59 4.32 4.27 ?
|
||||
_
|
||||
Rays c1east 521.6 285.3 230.5 215.1 ? Convex UNIX 6.0.1.12,
|
||||
*vgr c1east 4.66 4.49 4.20 4.24 ? vc -O1 (scalar)
|
||||
_
|
||||
Rays c1east 527.7 287.4 228.7 210.0 ? Convex UNIX 6.0.1.12,
|
||||
*vgr c1east 4.71 4.52 4.16 4.14 ? vc -O2 (vector)
|
||||
_
|
||||
Rays elxgnuy 644.7 349.3 264.6 242.1 ? System Vr2
|
||||
*vgr elxgnuy 5.75 5.49 4.81 4.77 ?
|
||||
_
|
||||
Rays mflow 845.2 439.5 313.1 338.9 ? (preliminary)
|
||||
*vgr mflow 7.54 6.91 5.69 6.68 ?
|
||||
_
|
||||
Rays venom 904.9 424.6 349.3 312.6 ? Concentrix 2.0,
|
||||
*vgr venom 8.07 6.68 6.35 6.17 ? 2 CEs, no vectors
|
||||
_
|
||||
Rays venom 1375.5 650.0 523.4 459.9 ? Concentrix 2.0,
|
||||
*vgr venom 12.27 10.22 9.52 9.07 ? 3 CEs, no vectors
|
||||
_
|
||||
Rays venom 1813.5 845.5 686.0 600.7 ? Concentrix 2.0,
|
||||
*vgr venom 16.17 13.29 12.47 11.85 ? 4 CEs, no vectors
|
||||
_
|
||||
Rays venom 2364.1 1104.4 870.2 775.9 ? Concentrix 2.0,
|
||||
*vgr venom 21.08 17.36 15.82 15.3 ? 5 CEs, no vectors
|
||||
_
|
||||
Rays snm2 2492.9 - - - ? Unicos 2.0,
|
||||
*vgr snm2 22.24 - - - ? no vectors, no optim
|
||||
_
|
||||
Rays hep 2502.0 - - - ? 1 PEM, npsw=10
|
||||
*vgr hep 22.32 - - - ?
|
||||
_
|
||||
Rays venom 2811.4 1319.0 1051.6 918.0 ? Concentrix 2.0,
|
||||
*vgr venom 25.08 20.74 19.12 18.1 ? 6 CEs, no vectors
|
||||
_
|
||||
Rays venom 3248.8 1533.0 1232.3 1065.9 ? Concentrix 2.0,
|
||||
*vgr venom 28.98 24.10 22.41 21.02 ? 7 CEs, no vectors
|
||||
_
|
||||
Rays patton 3453.3 1514.3 1271.2 1027.3 ? COS V115BF2
|
||||
*vgr patton 30.81 23.81 23.11 20.26 ? 1 CPU, no vectors
|
||||
_
|
||||
Rays venom 3677.3 1724.2 1375.4 1208.4 ? Concentrix 2.0,
|
||||
*vgr venom 32.80 27.11 25.01 23.83 ? 8 CEs, no vectors
|
||||
_
|
||||
Rays alliant 3972.9 1840.0 1457.2 1266.4 ? Concentrix 3.0,
|
||||
*vgr alliant 35.44 28.93 26.49 24.98 ? 8 CEs, no vectors
|
||||
_
|
||||
Rays hep 4055.9 - - - ? 1 PEM, npsw=40
|
||||
*vgr hep 36.18 - - - ?
|
||||
_
|
||||
Rays patton 6856.6 - 2522.2 - ? COS V115BF2
|
||||
*vgr patton 61.16 - 45.86 - ? 2 CPUs, no vectors
|
||||
_
|
||||
Rays patton 10205.1 - 3749.9 - ? COS V115BF2
|
||||
*vgr patton 91.04 - 68.18 - ? 3 CPUs, no vectors
|
||||
_
|
||||
Rays patton 13320.2 - 4955.6 - ? COS V115BF2
|
||||
*vgr patton 118.82 - 90.10 - ? 4 CPUs, no vectors
|
||||
.TE
|
||||
.NH 1
|
||||
RELEASE 2.3 STATISTICS (2-Nov-1987)
|
||||
.LP
|
||||
.TS H
|
||||
expand box;
|
||||
l l | n n n n | n | l.
|
||||
A/* H/W Moss World Star Bldg Mean S/W Notes
|
||||
_
|
||||
.TH
|
||||
Rays vgr 118.8 64.9 36.5 34.2 ? BSD 4.3
|
||||
*vgr vgr 1.0 1.0 1.0 1.0 1.0
|
||||
_
|
||||
Rays vmb 375.4 218.6 186.4 196.2 ? UTX 2.0
|
||||
*vgr vmb 3.16 3.37 5.11 5.74 ?
|
||||
_
|
||||
Rays venom 468.2 221.7 166.1 144.9 ? Concentrix 3.0,
|
||||
*vgr venom 3.94 3.42 4.55 4.24 ? 1 CE, no vectors
|
||||
_
|
||||
Rays sws2 471.9 258.4 202.5 186.4 ? Convex Unix 6.2.32.2
|
||||
*vgr sws2 3.97 3.98 5.55 5.45 ? vanilla cc -O
|
||||
_
|
||||
Rays vector 656.6 301.6 221.1 195.0 ? Concentrix 3.0,
|
||||
*vgr vector 5.53 4.65 6.06 5.70 ? 1 ACE, no vectors
|
||||
_
|
||||
Rays venom 827.3 424.0 327.1 287.9 ? Concentrix 3.0,
|
||||
*vgr venom 6.96 6.53 8.96 8.42 ? 2 CEs, no vectors
|
||||
_
|
||||
Rays vhs 958.3 545.6 447.0 414.1 ? -O2 optimization
|
||||
*vgr vhs 8.07 9.41 12.25 12.11 ?
|
||||
_
|
||||
Rays mseries 988.3 603.5 515.6 491.6 ?
|
||||
*vgr mseries 8.32 9.29 14.13 14.37 ?
|
||||
_
|
||||
Rays vector 1280.9 596.8 436.7 389.2 ? Concentrix 3.0,
|
||||
*vgr vector 10.78 9.19 11.96 11.38 ? 2 ACEs, no vectors
|
||||
_
|
||||
Rays venom 1288.7 630.6 486.4 428.0 ? Concentrix 3.0,
|
||||
*vgr venom 10.85 9.72 13.33 12.51 ? 3 CEs, no vectors
|
||||
_
|
||||
Rays venom 1732.9 853.2 645.4 560.1 ? Concentrix 3.0,
|
||||
*vgr venom 14.59 13.15 17.68 16.38 ? 4 CEs, no vectors
|
||||
_
|
||||
Rays bob 1856.7 801.9 574.1 500.3 ? 1 CPU, UNICOS 3.0,
|
||||
*vgr bob 15.63 12.36 15.73 15.62 ? CC -O
|
||||
_
|
||||
Rays vector 1952.1 881.7 647.6 578.8 ? Concentrix 3.0,
|
||||
*vgr vector 16.43 13.58 17.74 16.92 ? 3 ACEs, no vectors
|
||||
_
|
||||
Rays venom 2158.4 1031.3 797.3 703.1 ? Concentrix 3.0,
|
||||
*vgr venom 18.17 15.89 21.84 20.56 ? 5 CEs, no vectors
|
||||
_
|
||||
Rays bob 2346.1 1127.4 751.0 677.2 ? 1 CPU UNICOS 4.0
|
||||
*vgr bob 19.75 17.37 20.57 19.80 ? CC -O
|
||||
_
|
||||
Rays bob 2423.5 1045.7 719.3 609.4 ? 1 CPU, UNICOS 3.0,
|
||||
*vgr bob 20.40 16.11 19.71 17.82 ? VCC -O
|
||||
_
|
||||
Rays vector 2546.2 1170.0 867.2 758.7 ? Concentrix 3.0,
|
||||
*vgr vector 21.43 18.03 23.76 22.18 ? 4 ACEs, no vectors
|
||||
_
|
||||
Rays venom 2633.7 1232.7 943.4 839.5 ? Concentrix 3.0,
|
||||
*vgr venom 22.17 18.99 25.85 24.55 ? 6 CEs, no vectors
|
||||
_
|
||||
Rays venom 2769.4 1393.3 1098.1 971.6 ? Concentrix 3.0,
|
||||
*vgr venom 23.31 21.47 30.08 28.41 ? 7 CEs, no vectors
|
||||
_
|
||||
Rays vector 3131.2 1453.8 1065.8 945.4 ? Concentrix 3.0,
|
||||
*vgr vector 26.36 22.40 29.20 27.64 ? 5 ACEs, no vectors
|
||||
_
|
||||
Rays venom 3368.7 1605.3 1231.3 1095.11 ? Concentrix 3.0,
|
||||
*vgr venom 28.36 24.73 33.73 32.02 ? 8 CEs, no vectors
|
||||
_
|
||||
Rays patton 3456.5 1691.8 1169.0 1043.6 ? 1 CPU, UNICOS 2.1
|
||||
*vgr patton 29.10 26.07 32.03 30.51 ? no vectors
|
||||
_
|
||||
Rays vector 3686.4 1688.6 1259.1 1129.0 ? Concentrix 3.0,
|
||||
*vgr vector 31.03 26.02 34.49 33.01 ? 6 ACEs, no vectors
|
||||
_
|
||||
Rays vector 4140.3 1953.0 1463.3 1299.7 ? Concentrix 3.0,
|
||||
*vgr vector 34.85 30.09 40.09 38.00 ? 7 ACEs, no vectors
|
||||
_
|
||||
Rays bob 4641.7 2243.4 1498.2 1358.1 ? 2 CPUs, UNICOS 4.0
|
||||
*vgr bob 39.07 34.57 41.05 39.71 ? CC -O
|
||||
_
|
||||
Rays vector 4712.2 2226.3 1649.0 1469.7 ? Concentrix 3.0,
|
||||
*vgr vector 39.66 34.30 45.18 42.97 ? 8 ACEs, no vectors
|
||||
_
|
||||
Rays bob 6884.9 3422.4 2267.7 2034.3 ? 3 CPUs, UNICOS 4.0
|
||||
*vgr bob 57.95 52.73 62.13 59.48 ? CC -O
|
||||
_
|
||||
Rays bob 9477.1 4484.7 2947.0 2832.9 ? 4 CPUs, UNICOS 4.0
|
||||
*vgr bob 79.77 69.10 80.76 82.83 ? CC -O
|
||||
.TE
|
||||
.NH 1
|
||||
RELEASE 3.0 STATISTICS (10-Oct-1988)
|
||||
.LP
|
||||
.TS H
|
||||
expand box;
|
||||
l l | n n n n | n | l.
|
||||
A/* H/W Moss World Star Bldg Mean S/W Notes
|
||||
_
|
||||
.TH
|
||||
Abs vgr 138.85 67.15 54.48 49.11 77.39 BSD 4.3
|
||||
*vgr vgr 1.00 1.00 1.00 1.00 1.00 w/FPA
|
||||
_
|
||||
Abs sdm 163.56 76.98 59.79 52.51 88.21 SunOS 3.4
|
||||
*vgr sdm 1.17 1.14 1.09 1.06 1.11 w/68881
|
||||
_
|
||||
Abs ardec-3 417.95 212.43 177.01 160.73 242.03 9820, OSx 4.1
|
||||
*vgr ardec-3 3.01 3.16 3.24 3.27 3.17 -P 1
|
||||
_
|
||||
Abs spark 443.84 216.92 190.42 192.82 261.00 UTX 2.0
|
||||
*vgr spark 3.19 3.23 3.49 3.92 3.37 no MACC
|
||||
_
|
||||
Abs vmb 482.28 226.33 191.52 193.04 273.29 UTX 2.0
|
||||
*vgr vmb 3.47 3.37 3.51 3.93 3.57 no MACC
|
||||
_
|
||||
Abs sws2 546.23 255.45 183.10 163.85 287.15 Convex 6.2.32.2
|
||||
*vgr sws2 3.93 3.80 3.36 3.33 3.60 /bin/cc
|
||||
_
|
||||
Abs sun4 767.7 373.7 315.5 284.5 435.6 Unix 3.5
|
||||
*vgr sun4 5.52 5.56 5.79 5.79 5.62 -O2 optim
|
||||
_
|
||||
Abs video 940.33 469.30 399.21 367.64 544.12 UNIX 2.0
|
||||
*vgr video 6.77 6.98 7.32 7.48 7.13 -O2
|
||||
_
|
||||
Abs vhs 954.81 471.90 409.78 392.55 557.26 IRix 3.1
|
||||
*vgr vhs 6.87 7.02 7.52 7.99 7.45 Parallel, -P1
|
||||
_
|
||||
Abs bob 2602.68 1078.25 712.39 642.42 1258.93 UNICOS 4.0, /bin/cc
|
||||
*vgr bob 21.22 18.17 15.39 13.98 17.19 -P 1
|
||||
_
|
||||
Abs vector 3811.68 1469.80 1060.50 921.21 1815.79 Alliant 3.0
|
||||
*vgr vector 27.45 21.88 19.46 18.75 21.88 -P 5
|
||||
_
|
||||
Abs vector 4515.09 1751.94 1266.49 1090.85 2156.09 Alliant 3.0
|
||||
*vgr vector 32.51 26.08 23.24 22.21 26.01 -P 6
|
||||
_
|
||||
Abs patton 4550.67 1920.15 1298.61 1153.02 2230.61 UNICOS 3.0, /bin/cc
|
||||
*vgr patton 37.10 32.36 28.05 25.09 30.65 -P 1
|
||||
_
|
||||
Abs vector 5130.74 2004.49 1438.97 1261.36 2458.89 Alliant 3.0
|
||||
*vgr vector 36.95 29.85 26.41 25.68 29.72 -P 7
|
||||
_
|
||||
Abs bob 5186.24 2132.17 1409.10 1273.72 2500.30 UNICOS 4.0, /bin/cc
|
||||
*vgr bob 42.28 35.93 30.44 27.71 34.09 -P 2
|
||||
_
|
||||
Abs vector 5813.76 2260.61 1638.31 1422.82 2783.87 Alliant 3.0
|
||||
*vgr vector 41.87 33.66 30.07 28.97 33.64 -P 8
|
||||
_
|
||||
Abs bob 7934.12 3392.98 2119.11 1929.74 3843.98 UNICOS 4.0, /bin/cc
|
||||
*vgr bob 64.69 57.18 45.78 41.99 52.41 -P 3
|
||||
_
|
||||
Abs patton 8898.79 3782.55 2559.48 2292.13 4383.23 UNICOS 3.0, /bin/cc
|
||||
*vgr patton 72.56 63.75 55.30 49.88 60.37 -P 2
|
||||
_
|
||||
Abs bob 10734.52 4436.61 2883.53 2617.47 5168.03 UNICOS 4.0, /bin/cc
|
||||
*vgr bob 87.52 74.77 62.30 56.96 70.38 -P 4
|
||||
_
|
||||
Abs patton 13078.79 5631.95 3832.88 3416.90 6490.13 UNICOS 3.0, /bin/cc
|
||||
*vgr patton 106.64 94.92 82.81 74.36 89.68 -P 3
|
||||
_
|
||||
Abs patton 17157.78 7437.55 5073.58 4531.25 8550.04 UNICOS 3.0, /bin/cc
|
||||
*vgr patton 139.90 125.35 109.62 98.61 118.37 -P 4
|
||||
.TE
|
||||
.bp
|
||||
.NH 1
|
||||
RELEASE 3.3 STATISTICS
|
||||
.LP
|
||||
.TS H
|
||||
expand box;
|
||||
l l | n n n n n | n | l.
|
||||
A/* H/W Moss World Star Bldg M35 Mean P
|
||||
_
|
||||
.TH
|
||||
Abs vgr 121.89 54.47 45.17 40.35 49.02 62.18 1
|
||||
*vgr vgr 1.00 1.00 1.00 1.00 1.00 1.00
|
||||
_
|
||||
Abs spark 435.69 208.59 176.76 177.69 174.67 234.68 1
|
||||
*vgr spark 3.53 3.61 4.17 4.29 3.40 3.80
|
||||
_
|
||||
Abs vhs 973.11 475.00 384.62 351.12 343.44 505.45 1
|
||||
*vgr vhs 7.56 8.72 8.51 8.70 7.00 8.09
|
||||
_
|
||||
Abs voyage 1969.57 1001.21 862.77 809.61 786.11 1085.85 2
|
||||
*vgr voyage 15.31 18.38 19.10 20.06 16.03 17.77
|
||||
_
|
||||
Abs taylor 2446.98 1076.24 912.03 837.56 799.58 1214.47 1
|
||||
*vgr taylor 19.02 19.75 20.19 20.75 16.31 19.20
|
||||
_
|
||||
Abs viper 3255.73 1368.96 1102.71 1039.37 1008.15 1554.98 8
|
||||
*vgr viper 25.30 25.13 24.41 25.75 20.56 24.23
|
||||
_
|
||||
Abs vector 3956.86 1625.23 1234.03 1137.36 1121.41 1814.97 8
|
||||
*vgr vector 30.75 29.83 27.31 28.18 22.87 27.78
|
||||
_
|
||||
Abs taylor 4730.05 2225.56 1742.09 1590.57 1551.78 2368.01 2
|
||||
*vgr taylor 36.76 40.85 38.56 39.41 31.65 37.44
|
||||
_
|
||||
Abs patton 16028.8 7289.7 4827.9 4392.5 20829.2 53368.1 4
|
||||
*vgr patton 124.6 133.83 106.88 108.85 106.23 116.07
|
||||
.TE
|
||||
.NH 1
|
||||
ADDITIONAL STATISTICS
|
||||
.PP
|
||||
It would be greatly appreciated if you would return to BRL any
|
||||
statistics that you gather, including: which BRL CAD release
|
||||
was used, the manufacturer of the machine,
|
||||
hardware model name/number,
|
||||
OS/compiler software version numbers,
|
||||
presence or absence of floating point hardware,
|
||||
and the local name (preferably InterNet or UUCP) of the
|
||||
specific machine used.
|
||||
@@ -1,78 +0,0 @@
|
||||
.TH BW 5 BRL/CAD
|
||||
.SH NAME
|
||||
bw \- Black and White image file format and utilities
|
||||
.SH FORMAT
|
||||
A
|
||||
.I bw
|
||||
file contains sequences of pixels.
|
||||
Each pixel is stored as one \fBunsigned char\fR, and thus
|
||||
ranges in intensity from 0 (black) to 255 (white).
|
||||
The first pixel in a
|
||||
.I bw
|
||||
file is the lower left corner of the image.
|
||||
The pixels proceed from left-to-right across each scanline,
|
||||
with scanlines being written from the bottom to the top of the image.
|
||||
.PP
|
||||
By convention,
|
||||
.I bw
|
||||
images are usually square, and thus their dimensions
|
||||
can be determined by the file size. If this is not the case, often
|
||||
only the file width need be known by a program reading the file. History
|
||||
has left us with two "standard" sizes, 512x512 and the "hires" 1024x1024.
|
||||
A common practice for other file sizes is to include the file width in
|
||||
the filename.
|
||||
.PP
|
||||
At some time in the future
|
||||
.I bw
|
||||
files will probably get self-typing headers so that parameters such as
|
||||
their size can be automatically determined by programs.
|
||||
.SH UTILITIES
|
||||
.B bw-fb
|
||||
display a .bw format image on a framebuffer.
|
||||
.br
|
||||
.B fb-bw
|
||||
produce a .bw file from a framebuffer image.
|
||||
.br
|
||||
.B bw-pix
|
||||
convert a .bw file to a color .pix file.
|
||||
.br
|
||||
.B pix-bw
|
||||
convert a color .pix file to a .bw file.
|
||||
.br
|
||||
.B bwstat
|
||||
gives statistics concerning a .bw file.
|
||||
.br
|
||||
.B bwhist
|
||||
displays a histogram on a framebuffer.
|
||||
.br
|
||||
.B bwmod
|
||||
a filter to shift and scale pixel intensities.
|
||||
.br
|
||||
.B bwdiff
|
||||
yields the difference between two .bw files.
|
||||
.br
|
||||
.B bwrect
|
||||
extracts an arbitrary rectangle from a .bw file.
|
||||
.br
|
||||
.B bwcrop
|
||||
maps any quadrilateral in a .bw file into any rectangle.
|
||||
.br
|
||||
.B bwrot
|
||||
rotates, reverses, or inverts a .bw file.
|
||||
.br
|
||||
.B bwscale
|
||||
scales a .bw file larger or smaller.
|
||||
.br
|
||||
.B bwfilter
|
||||
a variety of 3x3 kernel filters for .bw images.
|
||||
.br
|
||||
.B bw3-pix
|
||||
merges three .bw files into one .pix file.
|
||||
.br
|
||||
.B pix-bw3
|
||||
separates .pix file RGB colors into three .bw files.
|
||||
.br
|
||||
.SH FILES
|
||||
file.bw
|
||||
.SH SEE ALSO
|
||||
brlcad(1), pix(5), and above named programs.
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
.TH CMAP 5 BRL/CAD
|
||||
.SH NAME
|
||||
cmap \- Framebuffer colormap file format and utilities
|
||||
.SH FORMAT
|
||||
A
|
||||
.I cmap
|
||||
file is a storage format for framebuffer colormaps.
|
||||
It is an ascii file with one line per colormap entry.
|
||||
In order to accommodate colormaps of any "depth" (number
|
||||
of bits per entry), 16 bit unsigned integers were selected
|
||||
(see
|
||||
.IR libfb (3)
|
||||
for a discussion of the C program interface to colormaps).
|
||||
A value of zero corresponds to full off, or black, a
|
||||
value of 65535 decimal or ffff hexidecimal corresponds to
|
||||
full on, or white. A given device will use as many of
|
||||
the "leftmost" bits as it can support.
|
||||
.PP
|
||||
Each line of the file has a decimal colormap index, followed
|
||||
by a tab character, and then three 4 digit
|
||||
hexadecimal values, separated by spaces, which correspond to
|
||||
the red, green, and blue, channels. Any blank lines or lines
|
||||
beginning with non-numeric characters are ignored, and can thus
|
||||
be used for comments.
|
||||
.PP
|
||||
There is no requirement for all 256 entries to be specified.
|
||||
What is done with any unspecified entries is up to the individual
|
||||
programs using the colormap.
|
||||
.SH EXAMPLE
|
||||
The beginning of an eight bit inverse video colormap might look
|
||||
as follows:
|
||||
.sp 1
|
||||
.nf
|
||||
# Inverse video colormap
|
||||
0 ff00 ff00 ff00
|
||||
1 fe00 fe00 fe00
|
||||
2 fd00 fd00 fd00
|
||||
3 fc00 fc00 fc00
|
||||
4 fb00 fb00 fb00
|
||||
.sp 1
|
||||
.SH UTILITIES
|
||||
.B fb-cmap
|
||||
save a colormap from a framebuffer.
|
||||
.br
|
||||
.B cmap-fb
|
||||
load a saved colormap into a framebuffer.
|
||||
.br
|
||||
.B fbcmap
|
||||
loads one of several "standard" colormaps.
|
||||
.br
|
||||
.B fbgamma
|
||||
loads gamma correcting colormaps.
|
||||
.SH FILES
|
||||
file.cm
|
||||
.SH SEE ALSO
|
||||
brlcad(1), and above named programs.
|
||||
-1771
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
|
||||
|
||||
General Discussion about how to Make Animations using the BRL CAD Package
|
||||
|
||||
There are several distinct aspects to producing an animation:
|
||||
|
||||
1) The creative insight.
|
||||
2) Specification of the geometry.
|
||||
3) Specification of the material properties, colors, textures.
|
||||
4) Specification of the model motion and articulation (choreography),
|
||||
plus specification of the camera motion and lighting details (cinematography).
|
||||
5) Previewing the animation sequence using wireframe tools.
|
||||
6) Computation ("rendering") of the final sequence in very low resolution,
|
||||
suitable for frame-buffer animation previews (see fbanim(1)).
|
||||
7) Computation ("rendering") of the final ray-traced images, storing them
|
||||
in .pix files.
|
||||
8) Viewing selected frames, to review them for quality.
|
||||
9) Recording of the final images either on videotape or 16mm movie film.
|
||||
@@ -1,85 +0,0 @@
|
||||
.TH PIX 5 BRL/CAD
|
||||
.SH NAME
|
||||
pix \- Color RGB image file format and utilities
|
||||
.SH FORMAT
|
||||
A
|
||||
.I pix
|
||||
file contains sequences of pixels.
|
||||
Each pixel is stored as three \fBunsigned char\fRs,
|
||||
first red, then green, then blue.
|
||||
The intensity of each color ranges from 0 ("off") to 255 ("on").
|
||||
The first pixel in a
|
||||
.I pix
|
||||
file is the lower left corner of the image.
|
||||
The pixels proceed from left-to-right across each scanline,
|
||||
with scanlines being written from the bottom to the top of the image.
|
||||
.PP
|
||||
By convention,
|
||||
.I pix
|
||||
images are usually square, and thus their dimensions
|
||||
can be determined by the file size. If this is not the case, often
|
||||
only the file width need be known by a program reading the file. History
|
||||
has left us with two "standard" sizes, 512x512 and the "hires" 1024x1024.
|
||||
A common practice for other file sizes is to include the file width in
|
||||
the filename.
|
||||
.PP
|
||||
At some time in the future
|
||||
.I pix
|
||||
files will probably get self-typing headers so that parameters such as
|
||||
their size can be automatically determined by programs.
|
||||
.SH UTILITIES
|
||||
.B pix-fb
|
||||
display a .pix format image on a framebuffer.
|
||||
.br
|
||||
.B fb-pix
|
||||
produce a .pix file from a framebuffer image.
|
||||
.br
|
||||
.B pix-bw
|
||||
convert a .pix file to a black and white .bw file.
|
||||
.br
|
||||
.B bw-pix
|
||||
convert a black and white .bw file to a .pix file.
|
||||
.br
|
||||
.B ap-pix
|
||||
convert an Applicon Color Plotter file to a .pix file.
|
||||
.br
|
||||
.B pixtile
|
||||
combine several small .pix files into one large one.
|
||||
.br
|
||||
.B pixstat
|
||||
gives statistics concerning a .pix file.
|
||||
.br
|
||||
.B pixhist
|
||||
displays a color histogram on a framebuffer.
|
||||
.br
|
||||
.B pixhist3d
|
||||
display three views of an RGB color space histogram on a framebuffer.
|
||||
.br
|
||||
.B pixhist3d-pl
|
||||
unix plot of RGB color space utilization.
|
||||
.br
|
||||
.B pixdiff
|
||||
shows which pixels/colors differ between two .pix files.
|
||||
.br
|
||||
.B pixrect
|
||||
extracts an arbitrary rectangle from a .pix file.
|
||||
.br
|
||||
.B pixrot
|
||||
rotate, reverse, or invert a .pix file.
|
||||
.br
|
||||
.B pixscale
|
||||
scale a .pix file up or down.
|
||||
.br
|
||||
.B pixfilter
|
||||
a collection of 3x3 kernel filters for .pix files.
|
||||
.br
|
||||
.B bw3-pix
|
||||
merges three .bw files into one .pix file.
|
||||
.br
|
||||
.B pix-bw3
|
||||
separates .pix file RGB colors into three .bw files.
|
||||
.br
|
||||
.SH FILES
|
||||
file.pix
|
||||
.SH SEE ALSO
|
||||
brlcad(1), bw(5), and above named programs.
|
||||
-247
@@ -1,247 +0,0 @@
|
||||
.TH PLOT3 5 BRL/CAD
|
||||
.SH NAME
|
||||
plot3 \- 3-D and color graphic plotting interface
|
||||
.SH DESCRIPTION
|
||||
Files of this format are produced by programs
|
||||
such as
|
||||
.IR pixhist3d-pl (1),
|
||||
using the routines
|
||||
described in
|
||||
.IR libplot3\^ (3)
|
||||
and are interpreted for various devices
|
||||
by standard programs described in
|
||||
.IR plot\^ (1G),
|
||||
as well as additional programs such as
|
||||
.IR pl-fb (1).
|
||||
The format of output from
|
||||
.IR libplot3
|
||||
differs from that of
|
||||
.IR libplot
|
||||
only in the addition of 3-D primatives and color.
|
||||
A graphics file is a stream of plotting instructions.
|
||||
Each instruction consists of an \s-1ASCII\s+1 letter
|
||||
usually followed by bytes of binary information.
|
||||
The instructions are executed in order.
|
||||
A point is designated by
|
||||
four bytes representing
|
||||
the
|
||||
.B x
|
||||
and
|
||||
.B y
|
||||
values;
|
||||
each value
|
||||
is a signed 16-bit integer.
|
||||
These integers are written with the most significant
|
||||
byte first.
|
||||
Three-dimensional data have an additional
|
||||
.B z
|
||||
value, which is assumed to be zero
|
||||
for two-dimensional instructions.
|
||||
The last designated point in an
|
||||
.BR l ,
|
||||
.BR m ,
|
||||
.BR n ,
|
||||
.BR p ,
|
||||
.BR L ,
|
||||
.BR M ,
|
||||
.BR N ,
|
||||
or
|
||||
.B P
|
||||
instruction becomes the ``current point''
|
||||
for the next instruction.
|
||||
.PP
|
||||
Each of the following descriptions begins with the name
|
||||
of the corresponding routine in
|
||||
.IR libplot3\^ (3).
|
||||
.TP 3
|
||||
.B m
|
||||
move: The next four bytes give a new current point.
|
||||
.TP
|
||||
.B n
|
||||
cont: Draw a line from the current point to
|
||||
the point given by the next four bytes.
|
||||
See
|
||||
.IR plot (1G).
|
||||
.TP
|
||||
.B p
|
||||
point: Plot the point given by the next four bytes.
|
||||
.TP
|
||||
.B l
|
||||
line: Draw a line from the point given by the next
|
||||
four bytes to the point given by the following four bytes.
|
||||
.TP
|
||||
.B t
|
||||
label: Place the following \s-1ASCII\s0 string so that its
|
||||
first character falls on the current point.
|
||||
The string is terminated by a new-line.
|
||||
.TP
|
||||
.B a
|
||||
arc: The first four bytes give the center, the next four give the
|
||||
starting point,
|
||||
and the last four give the end point of a circular arc.
|
||||
The least significant coordinate of the end point is
|
||||
used only to determine the quadrant.
|
||||
The arc is drawn counter-clockwise.
|
||||
.TP
|
||||
.B c
|
||||
circle: The first four bytes give the center of the circle,
|
||||
the next two the radius.
|
||||
Circles and arcs are not supported on all devices.
|
||||
.TP
|
||||
.B e
|
||||
erase: Start another frame of output.
|
||||
.TP
|
||||
.B f
|
||||
linmod: Take the following string, up to a new-line,
|
||||
as the style for drawing further lines.
|
||||
The styles are
|
||||
``dotted'',
|
||||
``solid'', ``longdashed'', ``shortdashed'', and ``dotdashed''.
|
||||
Effective only
|
||||
for the
|
||||
.B \-T4014
|
||||
and
|
||||
.B \-Tver
|
||||
options of
|
||||
.IR plot\^ (1G)
|
||||
(\s-1TEKTRONIX\s+1 4014 terminal and Versatec plotter).
|
||||
.TP
|
||||
.B s
|
||||
space: The next four bytes give
|
||||
the lower left corner of the plotting area;
|
||||
the following four give the upper right corner.
|
||||
The plot will be magnified or reduced to fit
|
||||
the device as closely as possible.
|
||||
.PP
|
||||
The following were added at BRL.
|
||||
Three-dimensional primitives have their
|
||||
.B z
|
||||
values ignored when displayed on
|
||||
two-dimensional devices.
|
||||
.TP 3
|
||||
.B C
|
||||
color: The next three bytes give respectively
|
||||
the intensities (0..255) of the three color components
|
||||
(additive colors red, green, and blue if a terminal;
|
||||
subtractive colors cyan, magenta, and yellow if hardcopy)
|
||||
to be used for subsequent plotting.
|
||||
The initial color is assumed to be (255,255,255),
|
||||
which is white on a terminal and black on hardcopy.
|
||||
Color specifications are ignored for black-and-white devices.
|
||||
.TP
|
||||
.B M
|
||||
3move: The next six bytes give a new current point.
|
||||
.TP
|
||||
.B N
|
||||
3cont: Draw a line from the current point to
|
||||
the point given by the next six bytes.
|
||||
See
|
||||
.IR plot\^ (1G).
|
||||
.TP
|
||||
.B P
|
||||
3point: Plot the point given by the next six bytes.
|
||||
.TP
|
||||
.B L
|
||||
3line: Draw a line from the point given by the next
|
||||
six bytes to the point given by the following six bytes.
|
||||
.TP
|
||||
.B S
|
||||
3space: The next six bytes give
|
||||
the minimum corner of the plotting area;
|
||||
the following six give the maximum corner.
|
||||
The plot will be magnified or reduced to fit
|
||||
the device as closely as possible.
|
||||
.TP
|
||||
.B F
|
||||
3flush:
|
||||
.TP
|
||||
.B x
|
||||
double_point: The double-precision version of point.
|
||||
.TP
|
||||
.B v
|
||||
double_line: The double-precision version of line.
|
||||
.TP
|
||||
.B o
|
||||
double_move: The double-precision version of move.
|
||||
.TP
|
||||
.B q
|
||||
double_cont: The double-precision version of cont.
|
||||
.TP
|
||||
.B w
|
||||
double_space: The double-precision version of space.
|
||||
.TP
|
||||
.B i
|
||||
double_circle: The double-precision version of circle.
|
||||
.TP
|
||||
.B r
|
||||
double_arc: The double-precision version of arc.
|
||||
.TP
|
||||
.B W
|
||||
double_3space: The double-precision, 3_D version of space.
|
||||
.TP
|
||||
.B X
|
||||
double_3point: The double-precision, 3_D version of point.
|
||||
.TP
|
||||
.B O
|
||||
double_3move: The double-precision, 3_D version of move.
|
||||
.TP
|
||||
.B Q
|
||||
double_3cont: The double-precision, 3_D version of cont.
|
||||
.TP
|
||||
.B V
|
||||
double_3line: The double-precision, 3_D version of line.
|
||||
.PP
|
||||
Space settings that exactly fill the plotting area
|
||||
with unity scaling appear below for
|
||||
devices supported by the filters of
|
||||
.IR plot\^ (1G).
|
||||
The upper limit is just outside the plotting area,
|
||||
except for the Megatek which displays the
|
||||
entire range of possible coordinates.
|
||||
In every case the plotting area is taken to be square;
|
||||
points outside may be displayable on
|
||||
devices whose face is not square.
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.TP 18
|
||||
.SM
|
||||
DASI \*S300
|
||||
space(0, 0, 4096, 4096);
|
||||
.TP
|
||||
.SM
|
||||
DASI \*S300s
|
||||
space(0, 0, 4096, 4096);
|
||||
.TP
|
||||
.SM
|
||||
DASI \*S450
|
||||
space(0, 0, 4096, 4096);
|
||||
.TP
|
||||
\s-1TEKTRONIX\s+1 4014
|
||||
space(0, 0, 3120, 3120);
|
||||
.TP
|
||||
Versatec plotter
|
||||
space(0, 0, 2048, 2048);
|
||||
.TP
|
||||
Megatek display
|
||||
space(-32768, -32768, 32767, 32767);
|
||||
.PD
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
libplot3(3),
|
||||
plot(3),
|
||||
plot(5).
|
||||
.br
|
||||
graph(1G), plot(1G) in the
|
||||
\f2\s-1UNIX\s+1 System User Reference Manual\fR.
|
||||
.SH AUTHOR
|
||||
Douglas A. Gwyn made the 3-D and color extensions to UNIX-plot.
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH BUG REPORTS
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@BRL.MIL>.
|
||||
-290
@@ -1,290 +0,0 @@
|
||||
.\" $Header$
|
||||
;Date: Fri, 24 Apr 87 9:58:56 EDT
|
||||
;From: Keith Applin (VLD/VMB) <keith@BRL.ARPA>
|
||||
|
||||
About MGED objects. The generic name given to any member of an MGED file
|
||||
is object. There are 2 divisions at the next level: primitives(solids) and
|
||||
combinations. The primitives are just as you might expect, the defining
|
||||
parameters. The combinations consist of members with a boolean operation.
|
||||
The combinations are further divided into regions and groups. A group
|
||||
is a combination consisting of any objects along with only the union
|
||||
operation. A region is a combination of any objects (but generally only
|
||||
primitives and other regions) along with any of the operations. These
|
||||
regions are special in that they are ALL that the ray-tracing evaluates
|
||||
or sees. Hence every path must contain a region for ray-tracing purposes.
|
||||
If a path does not have a region in it, then when ray-traced, a region will
|
||||
be created consisting of only the solid at the bottom of the path.
|
||||
The regions also have a material code number attached, to be used by some
|
||||
of the ray-tracing applications.
|
||||
|
||||
The procedure generally followed in building a model is:
|
||||
|
||||
1. Build the primitives at desired locations, etc
|
||||
2. Make the regions of these solids to produce the
|
||||
desired shape.
|
||||
3. Make higher level groups of these regions,
|
||||
generally according to function, etc
|
||||
NOTE: using this procedure, the regions
|
||||
cannot occupy the same volume in space(overlap)
|
||||
|
||||
I got your "castle" today and took a quick look at castle.g. The use of
|
||||
all regions (using the union operation) allows just about everything to
|
||||
overlap (interfere). The "E" command in MGED does not know how to
|
||||
evaluate regions within regions, hence you must use the "e" command to
|
||||
display such animals.
|
||||
|
||||
I didn't get a chance to look at castle-gr.g, but I assume you used groups
|
||||
(non-region combinations) to define the higher levels instead of regions.
|
||||
Of course, once you do this, any overlaps between the lower level regions
|
||||
will show up during ray-tracing.
|
||||
|
||||
Both ways of doing business are okay, except you must be careful about
|
||||
overlapping regions when higher levels are made using groups. I guess
|
||||
it is a case of personal preference.
|
||||
========================================
|
||||
;Date: Sun, 26 Apr 87 18:51:29 edt
|
||||
;From: Mike McDonnell <mike>
|
||||
|
||||
Thanks for your clear explanation of the differences between
|
||||
regions and groups. I now understand some of the differences
|
||||
between the two types of combination objects. I also still don't
|
||||
*like* those differences, at least in some respects. For example,
|
||||
if the raytracer only sees regions then why can't MGED evaluate
|
||||
[E] hierarchies of regions? This is a nice way to preview a
|
||||
model in detail before you raytrace it. Much cheaper than
|
||||
raytracing, and much better than 'e' evaluation for complex
|
||||
objects. Is there a good reason for this behavior? As a
|
||||
newcomer to the CAD package I can maybe see the ugly aspects of
|
||||
it better than some of you "old hands" who have come to accept
|
||||
its peculiarities. In fact I still see no good reason to have
|
||||
such an entity as a group at all. Why not make a group a special
|
||||
case of a region and make regions equally acceptable to all the
|
||||
various programs in the CAD package? If the purpose of groups is
|
||||
to have a way to check that nothing overlaps, then it seems to me
|
||||
that this can be checked by special commands operating on
|
||||
regions. If the "purpose" of groups is that they are historical
|
||||
baggage, then they should be excised as a warty complication of
|
||||
what could be an elegant system in which there are only solids
|
||||
and regions with solids as leaf nodes and regions for all
|
||||
interior nodes.
|
||||
========================================
|
||||
;Date: Mon, 27 Apr 87 13:39:32 EDT
|
||||
;From: "Gary S. Moss (SLCBR-VLD-V)" <moss@BRL.ARPA>
|
||||
|
||||
For our mission, we require there be groups as such. Regions are used
|
||||
to describe low-level functional units of homogeneous material composition.
|
||||
Groups are used to combine regions in order to assemble higher level functional
|
||||
units of heterogeneous material composition or to describe application-specific
|
||||
lists of objects. As far as the software is concerned, groups are not
|
||||
boolean combinations, but simple lists of objects. That is why these pseudo
|
||||
unions will result in overlaps if the 2 members of a group occupy the same
|
||||
space. If groups WERE evaluated as unions, it would incur considerable CPU
|
||||
overhead, and would encourage mis-use of this construct. That is, someone
|
||||
could model two road wheels that happened to overlap (due to modeling
|
||||
error) and then group them together to form a "road_wheels" group, which
|
||||
would take care of the overlap by unioning them together. Typically, we
|
||||
group most of the description into an application-specific entity like
|
||||
"exterior" for doing a certain type of analysis. Now, if groups were
|
||||
really unions of objects, nothing could possible overlap. For our mission,
|
||||
we MUST have accurate geometry, and this would allow errors to go unnoticed.
|
||||
|
||||
The region evaluator in MGED is deficient in that it does not handle
|
||||
regions within regions. We have always known this, the code that does
|
||||
the region evaluation was taken from the CIDD code which does not
|
||||
support regions within regions. It has been improved somewhat since it
|
||||
was grafted onto MGED, but we intend to rewrite it eventually. This
|
||||
project is not high on our priority list.
|
||||
|
||||
The RT library handles regions within regions fine, but since they are
|
||||
supposed to be of homogeneous material composition, the upper-most
|
||||
region material ID takes precedence. Perhaps the regions could be
|
||||
modified to include the group as a special case, but this does not sound
|
||||
"cleaner" to me given the functional distinctions that I have
|
||||
mentioned. I think "historical baggage" is not an accurate description
|
||||
of groups, because they are much cheaper then regions and have a
|
||||
distinct purpose.
|
||||
|
||||
~moss/...
|
||||
========================================
|
||||
;Date: Wed, 29 Apr 87 2:01:37 EDT
|
||||
;From: Mike Muuss <mike@BRL.ARPA>
|
||||
|
||||
The "problem" with regions is more of a definitional one. Internal to
|
||||
the software, there are only two types of nodes, non-terminal ("combinations")
|
||||
and terminal ("solids"). It is possible to set a flag on a non-terminal
|
||||
node marking it as a region.
|
||||
|
||||
The problem comes from the fact that everything above the region flagged node
|
||||
(towards the root) is used for grouping, where as everything below the
|
||||
region flagged node is actually defining a single, solid, self-consistent
|
||||
chunk of 3-d space. Therefore, regions are chunks of 3-space, and
|
||||
regions are grouped together to form the model. It is permitted in RT,
|
||||
but not in some earlier software, to perform non-union operations on
|
||||
regions (ie, subtract one region from another).
|
||||
|
||||
The "big-E" command in MGED is slated for overhaul. The task of
|
||||
"facetizing" a CSG model is a difficult one; the current code in MGED,
|
||||
while very useful, is quite inadequate. I had hoped to have created
|
||||
a general capability for facetizing MGED databases last year, but lots
|
||||
of things (most importantly the Cray, and the CAD Distribution itself)
|
||||
kept getting prioritized ahead of that project, and it still languishes.
|
||||
|
||||
Best,
|
||||
-Mike
|
||||
|
||||
From: Keith Applin (VLD/VMB) <keith@BRL.ARPA>
|
||||
Subject: Good Modeling Practices
|
||||
|
||||
Solid modeling using MGED can tend to be quite individual, however I
|
||||
will attempt to give my version ( < 500 words ) of some "good" modeling
|
||||
practices. To model a particular object, I would recommend something
|
||||
like this:
|
||||
|
||||
First decide how to represent the object, including the amount
|
||||
of detail and the solid[s] and region[s] necessary. Then the solids
|
||||
are created and edited to have the size, shape, and orientation desired.
|
||||
Solids can be created via "make", "cp", "mirror", or "in" commands.
|
||||
Depending on complexity the solids are created in the desired location
|
||||
or; to take advantage of symmetry created at the origin and later
|
||||
translated (and "push"ed) to the desired location. Once all the solids
|
||||
are finished it is time to create the region[s], which tell how to combine
|
||||
the solids to represent the object. The region[s] are then given
|
||||
the desired item/air and material codes. I usually use the "edcodes"
|
||||
command to do this. The region[s] are then put into a group, usually
|
||||
for function. A group is just a collection of objectslity definition.
|
||||
for functionality definition. A group really has no operation as such,
|
||||
and is really just a collection of objects.
|
||||
|
||||
Now a little bit about regions. Regions are the objects that the
|
||||
application ray-tracing interrogates. If solids are not part of
|
||||
regions they will not be "seen" at all. Some ray-trace applications
|
||||
will create a default region out of such an orphan solid. Thus one
|
||||
in general does not have solids in a "functional" group. There are
|
||||
times when temporary groups are made, say for editing purposes, where
|
||||
it is desirable to include solids.
|
||||
|
||||
There are three operations allowed in regions; intersection (+),
|
||||
union (u) and difference (-). Intersection gives the common volume,
|
||||
union gives the volume in all members, and difference subtracts from one
|
||||
member the common volume with a second. The union operator needs
|
||||
clarification as to precedence:
|
||||
|
||||
r region1 u solid1 - solid2 u solid3 - solid4
|
||||
|
||||
is evaluated as: region1 = u (solid1 - solid2) u (solid3 - solid4)
|
||||
|
||||
Thus, the above region with unions is the same as the two regions:
|
||||
|
||||
r region1 + solid1 - solid2 and r region2 + solid3 - solid4
|
||||
|
||||
In fact, it is probably better practice to make the two distinct regions.
|
||||
Of course, by using the two regions instead of the "union" region, one
|
||||
must be aware of possible interference between the two regions.
|
||||
|
||||
Note, r region1 u solid1 - solid2 and r region1 + solid1 - solid2
|
||||
produce the exact same results; however, for good practice one should use the
|
||||
union only when the region is really intended for unions (ie more than
|
||||
one union operation).
|
||||
|
||||
Members of regions are generally solids, however other regions are
|
||||
acceptable. Again it is probably good practice to use regions as
|
||||
members of other regions only when really necessary.
|
||||
|
||||
The above is a brief summary of my views of "good" modeling practices,
|
||||
for what it's worth. Comments?
|
||||
|
||||
-keith-
|
||||
|
||||
From: "Gary S. Moss" (VLD/VMB) <moss@BRL.ARPA>
|
||||
|
||||
The suggestion of parenthesis is a good one, however the modeler
|
||||
is not designed in a way that would accommodate this scheme, at least not
|
||||
in a straightforward manner. There is no place to store an "expression"
|
||||
that represents the region set operations. The way it is done is that
|
||||
every member of a region contains an operation and the boolean expression
|
||||
falls out of the order of the region members as entered with the "r"egion
|
||||
command, with precedence following a couple of rules;
|
||||
|
||||
1] operations are applied "left to right" (the current operation
|
||||
is done to the current solid with respect to the existing region).
|
||||
|
||||
2] there are implied parenthesis that lie in-between union operators.
|
||||
|
||||
so
|
||||
|
||||
+ s1 - s2 + s3 u s4 - s5 u s6
|
||||
|
||||
is equivalent to:
|
||||
|
||||
((s1 - s2) + s3) u (s4 - s5) u s6
|
||||
|
||||
that is, if parenthesis were allowed. Therefore, you can think of the
|
||||
solids between unions (surrounded by implied parenthesis) as sub-regions.
|
||||
The order of the region members (which can be printed out with the "l"
|
||||
command) is critical, and must be scrutinized when members are added or
|
||||
deleted from a region.
|
||||
|
||||
Physically, the only thing that is stored in the region record
|
||||
is the number of members (length). Immediately following the region
|
||||
record are "length"-many member records which contain; the object's name,
|
||||
the set operation, and a transformation matrix. It is not clear that we
|
||||
could permit parenthesis without radical redesign of the data base
|
||||
structure. Although I concede that it would be nice, it does not seem to
|
||||
be justified once you understand how the implied precedence work.
|
||||
|
||||
Thoughts anyone?
|
||||
~moss/...
|
||||
|
||||
From: Mike Muuss <mike@BRL.ARPA>
|
||||
|
||||
Using "groups" BELOW the "region" node for expression grouping
|
||||
is perfectly fine. Using the implied parens around UNION operators
|
||||
is another strategy.
|
||||
|
||||
Parens would be nice, but we don't presently have any easy way of
|
||||
storing them. Early versions of librt didn't know about the
|
||||
"implied parens" rule, a legacy from GIFT, now we are stuck with it.
|
||||
|
||||
Overall, I don't feel the present state is unacceptable.
|
||||
Best,
|
||||
-Mike
|
||||
|
||||
From: "John R. Anderson" (VLD/ASB) <jra@BRL.ARPA>
|
||||
|
||||
Gwyn suggested in a previous message that a component should be kept as
|
||||
a single region if possible. Back in the days of GIFT, it was common
|
||||
practice to describe a component with more than one region. We tried to
|
||||
stay away from complex regions mainly because the more complicated the
|
||||
region, the harder it is to figure out what is going on and what effects
|
||||
a single change might have. Therfore, a component was often a series of
|
||||
simple regions with the same ident code. I use the term "component" to
|
||||
refer to an object with a particular ident code, but I'm not sure this
|
||||
is still the accepted definition. I have no qualms about letting "mged"
|
||||
or "rt" crunch through complex regions, but I think we should make it
|
||||
very clear to all users if components described as a group of regions
|
||||
are going to cause them trouble later on.
|
||||
|
||||
|
||||
-John
|
||||
|
||||
From: Earl Weaver (VLD/ASB) <earl@BRL.ARPA>
|
||||
|
||||
Perhaps we have a semantic problem here. The term "component" may mean
|
||||
different things to different people. For example, most people would
|
||||
think of a flight control rod in a helicopter as one component. However
|
||||
an application program may need to know the difference between the
|
||||
tube-part of the control rod and each end (or clevis) of the rod because
|
||||
those sections of the control rod might exhibit different physical
|
||||
properties. Thus it would be appropriate to model that one "component"
|
||||
(which in reality is one piece--not designed to be disassembled) as
|
||||
three regions and each one can be treated as a component. My practice
|
||||
would be to group those three "regions" into "control_rod", then further
|
||||
group the control rods into flight controls.
|
||||
|
||||
-Earl
|
||||
|
||||
From: Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA>
|
||||
|
||||
I think "component" should still be identified with a collection of MGED
|
||||
"regions" that share an "ident code". For the time being I don't see
|
||||
any necessity to make an actual single MGED "region" out of them.
|
||||
@@ -1,96 +0,0 @@
|
||||
The BRL CAD PACKAGE
|
||||
Short Summary
|
||||
|
||||
In FY87 two major releases of the BRL CAD Package software were
|
||||
made (Feb-87, July-87), along with two editions of the associated
|
||||
400 page manual. The package includes a powerful solid modeling
|
||||
capability and a network-distributed image-processing capability.
|
||||
This software is now running at over 300 sites. It has been
|
||||
distributed to 42 acedemic institutions in twenty states and four
|
||||
contries including Yale, Princeton, Stanford, MIT, USC, and UCLA.
|
||||
The University of California - San Diego is using the package for
|
||||
rendering brains in their Brain Mapping Project at the
|
||||
Quantitative Morphology Laboratory. 75 different businesses have
|
||||
requested and received the software including 23 Fortune 500
|
||||
companies including: General Motors, AT&T, Crysler Motors
|
||||
Corporation, Boeing, McDonnell Douglas, Lockheed, General
|
||||
Dynamics, LTV Aerospace & Defense Co., and Hewlett Packard. 16
|
||||
government organizations representing all three services, NSA,
|
||||
NASA, NBS and the Veterns Administration are running the code.
|
||||
Three of the four national laboratories have copies of the BRL
|
||||
CAD package. More than 500 copies of the manual have been
|
||||
distributed.
|
||||
|
||||
BRL-CAD started in 1979 as a task to provide an interactive
|
||||
graphics editor for the BRL target description data base.
|
||||
|
||||
Today it is > 100,00 lines of C source code:
|
||||
|
||||
Solid geometric editor
|
||||
Ray tracing utilities
|
||||
Lighting model
|
||||
Many image-handling, data-comparison, and other
|
||||
supporting utilities
|
||||
|
||||
It runs under UNIX and is supported over more than a dozen product
|
||||
lines from Sun Workstations to the Cray 2.
|
||||
|
||||
In terms of geometrical representation of data, BRL-CAD supports:
|
||||
|
||||
the original Constructive Solid Geometry (CSG) BRL data
|
||||
base which has been used to model > 150 target descriptions,
|
||||
domestic and foreign
|
||||
|
||||
extensions to include both a Naval Academy spline
|
||||
(Uniform B-Spline Surface) as well as a U. of
|
||||
Utah spline (Non-Uniform Rational B-Spline [NURB] Surface)
|
||||
developed under NSF and DARPA sponsorship
|
||||
|
||||
a facetted data representation, (called PATCH),
|
||||
developed by Falcon/Denver
|
||||
Research Institute and used by the Navy and Air Force for
|
||||
vulnerability and signature calculations (> 200 target
|
||||
descriptions, domestic and foreign
|
||||
|
||||
It supports association of material (and other attribute properties)
|
||||
with geometry which is critical to subsequent applications codes.
|
||||
|
||||
It supports a set of extensible interfaces by means of which geometry
|
||||
(and attribute data) are passed to applications:
|
||||
|
||||
Ray casting
|
||||
Topological representation
|
||||
3-D Surface Mesh Generation
|
||||
3-D Volume Mesh Generation
|
||||
Analytic (Homogeneous Spline) representation
|
||||
|
||||
Applications linked to BRL-CAD:
|
||||
|
||||
o Weights and Moments-of-Inertia
|
||||
o An array of Vulnerability/Lethality Codes
|
||||
o Neutron Transport Code
|
||||
o Optical Image Generation (including specular/diffuse reflection,
|
||||
refraction, and multiple light sources, animation, interference)
|
||||
o Bistatic laser target designation analysis
|
||||
o A number of Infrared Signature Codes
|
||||
o A number of Synthetic Aperture Radar Codes (including codes
|
||||
due to ERIM and Northrop)
|
||||
o Acoustic model predictions
|
||||
o High-Energy Laser Damage
|
||||
o High-Power Microwave Damage
|
||||
o Link to PATRAN [TM] and hence to ADINA, EPIC-2, NASTRAN, etc.
|
||||
for structural/stress analysis
|
||||
o X-Ray calculation
|
||||
|
||||
BRL-CAD source code has been distributed to approximately 300
|
||||
computer sites, several dozen outside the US.
|
||||
|
||||
With the addtion of the PATCH geometry, requested and funded by the JTCG,
|
||||
the BRL-CAD environment will provide the superset environment of the
|
||||
combined Army/Navy/Air-Force vulnerability communities.
|
||||
|
||||
The BRL is now working with the Intelligence Community (led by the CIA)
|
||||
to provide a uniform geometry/attribute/interface capability
|
||||
together with a large library of target descriptions to support
|
||||
the ATR and exploitation community. A super-set of the current
|
||||
BRL-CAD environment is the leading candidate for that role.
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
The BRL-CAD Package includes a powerful solid modeling capability and
|
||||
a network-distributed image-processing capability. This software is now
|
||||
running at over 400 sites. It has been distributed to 42 acedemic
|
||||
institutions in twenty states and four contries. 75 different businesses
|
||||
have requested and received the software including 23 Fortune 500
|
||||
companies. 16 government organizations representing all three services,
|
||||
NSA, NASA, NBS and the Veterns Administration are running the code.
|
||||
Three of the four national laboratories have copies of the BRL CAD
|
||||
package.
|
||||
|
||||
BRL-CAD started in 1979 as a task to provide an interactive graphics
|
||||
editor for the BRL vehicle-description data base. Today the package
|
||||
totals more than 150,00 lines of "C" source code. It runs under UNIX and
|
||||
is supported over more than a dozen product lines from Sun Workstations
|
||||
to the Cray 2. The package includes:
|
||||
|
||||
A Solid geometric editor
|
||||
The Ray tracing library
|
||||
Two Lighting models
|
||||
Many image-handling, data-comparison, and other supporting utilities
|
||||
|
||||
In terms of geometrical representation of data, BRL-CAD supports:
|
||||
|
||||
The original Constructive Solid Geometry (CSG) BRL database.
|
||||
|
||||
Extensions to include solids made from collections of
|
||||
Uniform B-Spline Surfaces as well as
|
||||
Non-Uniform Rational B-Spline [NURB] Surfaces.
|
||||
|
||||
A facetted data representation.
|
||||
|
||||
It supports association of material (and other attribute properties)
|
||||
with geometry which is critical to subsequent applications codes.
|
||||
It supports a set of extensible interfaces by means of which geometry
|
||||
(and attribute data) are passed to applications.
|
||||
|
||||
Applications linked to BRL-CAD:
|
||||
|
||||
o Weights and Moments-of-Inertia
|
||||
o Optical Image Generation (including specular/diffuse reflection,
|
||||
refraction, and multiple light sources, animation, interference)
|
||||
o Bistatic laser analysis
|
||||
o A number of Synthetic Aperture Radar Codes (including codes due to ERIM)
|
||||
o Acoustic model predictions
|
||||
o High-Energy Laser Damage
|
||||
o High-Power Microwave Damage
|
||||
o An array of V/L Codes
|
||||
o Neutron Transport Code
|
||||
o Link to PATRAN [TM] and hence to ADINA, EPIC-2, NASTRAN, etc.
|
||||
for structural/stress analysis
|
||||
o X-Ray calculation
|
||||
|
||||
For more details about what geometric models are useful for, see M.
|
||||
Muuss, ``Understanding the Preparation and Analysis of Solid Models'',
|
||||
in ``Techniques for Computer Graphics'', ed: Rogers & Earnshaw, Springer
|
||||
Verlag, 1987.
|
||||
|
||||
To obtain a copy of the BRL CAD Package distribution, you must send
|
||||
enough magnetic tape for 20 Mbytes of data. Standard nine-track
|
||||
half-inch magtape is the strongly preferred format, and can be written
|
||||
at either 1600 or 6250 bpi, in TAR format with 10k byte records. For
|
||||
sites with no half-inch tape drives, Silicon Graphics and SUN tape
|
||||
cartridges can also be accommodated. With your tape, you must also
|
||||
enclose a letter indicating
|
||||
|
||||
(a) who you are,
|
||||
(b) what the BRL CAD package is to be used for,
|
||||
(c) the equipment and operating system(s) you plan on using,
|
||||
(d) that you agree to the conditions listed below.
|
||||
|
||||
This software is an unpublished work that is not generally available to
|
||||
the public, except through the terms of this limited distribution.
|
||||
The United States Department of the Army grants a royalty-free,
|
||||
nonexclusive, nontransferable license and right to use, free of charge,
|
||||
with the following terms and conditions:
|
||||
|
||||
1. The BRL CAD package source files will not be disclosed to third
|
||||
parties. BRL needs to know who has what, and what it is being used for.
|
||||
|
||||
2. BRL will be credited should the software be used in a product or written
|
||||
about in any publication. BRL will be referenced as the original
|
||||
source in any advertisements.
|
||||
|
||||
3. The software is provided "as is", without warranty by BRL.
|
||||
In no event shall BRL be liable for any loss or for any indirect,
|
||||
special, punitive, exemplary, incidental, or consequential damages
|
||||
arising from use, possession, or performance of the software.
|
||||
|
||||
4. When bugs or problems are found, you will make a reasonable effort
|
||||
to report them to BRL.
|
||||
|
||||
5. Before using the software at additional sites, or for permission to
|
||||
use this work as part of a commercial package, you agree to first obtain
|
||||
authorization from BRL.
|
||||
|
||||
6. You will own full rights to any databases or images you create with this
|
||||
package.
|
||||
|
||||
All requests from US citizens, or from US government agencies should be
|
||||
sent to:
|
||||
|
||||
Mike Muuss
|
||||
Ballistic Research Lab
|
||||
Attn: SLCBR-SECAD
|
||||
APG, MD 21005-5066
|
||||
|
||||
If you are not a US citizen (regardless of any affiliation with a
|
||||
US industry), or if you represent a foreign-owned or foreign-controlled
|
||||
industry, you must send your letter and tape through your Ambassador to
|
||||
the United States in Washington DC. Have your Ambassador submit the
|
||||
request to:
|
||||
|
||||
Army Headquarters
|
||||
Attn: DAMI-FL
|
||||
Washington, DC 20310
|
||||
|
||||
|
||||
Best Wishes,
|
||||
-Mike Muuss
|
||||
|
||||
Leader, Advanced Computer Systems Team
|
||||
ArpaNet: <Mike @ BRL.ARPA>
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
|
||||
|
||||
Specific details about producing an animation of a gun tube,
|
||||
using the BRL CAD Package and various IBD simulation codes.
|
||||
|
||||
As things presently stand, the central part of this linkage is a program
|
||||
called TUBE.C that takes two input files describing the motion of the
|
||||
scene, and generates an MGED database containing a separate tree
|
||||
(Directed Acyclic Graph [DAG]) for each frame. The name of combination
|
||||
at the top of the tree is the letter "g" (for group) followed by the
|
||||
frame number, so that the first frame of the animation is tree "g0", the
|
||||
second frame is tree "g1", etc.
|
||||
|
||||
The current X displacement data for the gun tube center of mass points
|
||||
is presently contained in the array dxtab[] compiled into the program.
|
||||
|
||||
The input file "pos.dat" contains the projectile position data. On each
|
||||
input line, the time (in milliseconds) is listed first, followed by the
|
||||
X displacement of the base of the projectile, offset from the projectile
|
||||
starting position. The time values listed in this file do not have to
|
||||
correspond to the time values listed for the articulation; the proper
|
||||
time will be chosen by the program. If the file "tank.out" contains the
|
||||
output from a normal run of IBHVG2, the file "pos.dat" can be created by
|
||||
running this Shell script:
|
||||
|
||||
cat tank.out |
|
||||
sed -n '/ TIME TRAV/,/ PROJECTILE EXIT/p' |
|
||||
grep -v "[A-Z]" |
|
||||
cut -c2-132 |
|
||||
grep -v "^[ ]*$" |
|
||||
awk '{printf "%10.2f %10.2f\n", $1, $2 }' > pos.dat
|
||||
|
||||
The mass displacement file is presented to the TUBE program on standard
|
||||
input, where each time step has the following format: First a line with
|
||||
the word "TIME" followed by a floating point number, in miliseconds.
|
||||
Then, one input line for each of ``nmass'' (eg, 12) mass points, in
|
||||
ascending order of mass point number, starting with one, with one
|
||||
integer and three floating point numbers on each line: the mass number,
|
||||
the X, Y, and Z deviations (currently expected in inches, where +X is
|
||||
towards the muzzle, +Y is in the vertical direction, and +Z is to the
|
||||
right of the muzzle). There must be excatly one blank line after the
|
||||
last mass point data line and before the next "TIME" line. Note that
|
||||
mass point 1 corresponds to "m1" on the diagram, and mass point 12 is
|
||||
"m12" on the diagram. The position of a two additional points (0 and
|
||||
13) are guessed within the program, with mass point 0 being the outer
|
||||
edge of the breach block, and mass point 13 being the muzzle end, but
|
||||
these two points are not specified in the input file. Eg,
|
||||
|
||||
TIME 0.02
|
||||
1 0.01 0.00035 0.00000075
|
||||
2 0.01 0.00040 0.00000900
|
||||
(etc)
|
||||
12 1.01 0.0784 3.129
|
||||
|
||||
TIME 0.04
|
||||
(etc)
|
||||
|
||||
Therefore, assuming the the mass displacement file is in "mass.dat",
|
||||
and that the "pos.dat" file exists in the same directory,
|
||||
and that the model for the projectile is in the file "projectile.g"
|
||||
with main (top) combination named "ke",
|
||||
the TUBE program is run as follows:
|
||||
|
||||
tube < mass.dat > anim.g
|
||||
cat projectile.g >> anim.g
|
||||
|
||||
This MGED database can be examined with MGED. To see the first
|
||||
frame, say:
|
||||
|
||||
mged anim.g
|
||||
|
||||
then respond to the "attach" question appropriately for the type of
|
||||
graphics device being used, and then enter the command
|
||||
|
||||
B g0
|
||||
|
||||
This will display the geometry configuration for frame zero.
|
||||
The "B" command in MGED stands for "Blast screen clear, then display
|
||||
named object(s)". To view frame 42, enter the command
|
||||
|
||||
B g42
|
||||
|
||||
and so on. The MGED control dials can be used to translate, rotate,
|
||||
and zoom the current viewpoint. When a desirable viewpoint has been
|
||||
selected, it can saved in a file called "view1.sh" with the command
|
||||
|
||||
saveview view1.sh
|
||||
|
||||
This file is actually a Shell script that will render that one frame for
|
||||
you, using RT, and store it in a file. However, in this case, a text
|
||||
editor is used to extract just the viewsize, eye point, and homogenous
|
||||
transform matrix (20 numbers in all) and store them in another file, say
|
||||
"view1.mat".
|
||||
|
||||
To preview the whole animation in wireframe format, assuming that there
|
||||
are 300 frames running 0 to 299, this Shell script (called, say,
|
||||
"preview.sh") is used:
|
||||
|
||||
rm -f temp.sh
|
||||
cat << END > temp.sh
|
||||
mged anim.g
|
||||
attach ir (for SGI 3-D, or "sgi" for SGI 4-D)
|
||||
B g0
|
||||
rmats view1.mat
|
||||
END
|
||||
for frame in `loop 0 299`
|
||||
do
|
||||
echo "B g${frame}" >> temp.sh
|
||||
done
|
||||
sh temp.sh
|
||||
rm -f temp.sh
|
||||
|
||||
Assuming that this animation sequence and viewpoint are satisfactory,
|
||||
and that the desired "graph paper" background file is stored in a
|
||||
128x128 .pix file called "movie128bw.pix" in the current directory,
|
||||
the animation can be rendered the Shell script given below (called, say,
|
||||
"render.sh"):
|
||||
|
||||
for frame in `loop 0 299`
|
||||
do
|
||||
rt -s512 -M -o out.pix.${frame} \
|
||||
anim.g g${frame} < view1.mat >>& render.log
|
||||
done
|
||||
|
||||
The "-s512" parameter specifies that the desired image is to be square,
|
||||
and 512x512 pixels in size. This is typically the desired resolution
|
||||
for videotape. The "-M" parameter specifies that the view matrix is to
|
||||
be obtained from stdin. The "-o out.pix.${frame}" says that the output
|
||||
picture is to be stored in a file called "out.pix.123" where "123"
|
||||
represents the current frame number. (The backslash at the end of the
|
||||
line continues the command to the next line). Specifying "anim.g"
|
||||
names the input MGED database, and "g${frame}" specifies the treetop
|
||||
appropriate for the current frame.
|
||||
|
||||
Because this procedure is likely to take a significant amount of time,
|
||||
the shell script should be submitted as a batch job. On the minicomputers,
|
||||
the MDQS command
|
||||
|
||||
batch render.sh
|
||||
|
||||
should be used. On both of the UNICOS Cray systems, the NQS command
|
||||
|
||||
qsub render.sh
|
||||
|
||||
should be used.
|
||||
|
||||
To view one of these files, the Shell environment variable FB_FILE
|
||||
should be set to indicate the appropriate framebuffer on the network
|
||||
to use, and the program "pix-fb" is used to transfer the picture to
|
||||
the framebuffer. For more details on the variable FB_FILE, consult
|
||||
the brlcad(1) manual page; for more details on the program "pix-fb",
|
||||
consult the pix-fb(1) manual page; for more details on the framebuffer
|
||||
library, consult libfb(3) manual page. This can be done on BRL-IBD
|
||||
with these commands:
|
||||
|
||||
man brlcad
|
||||
man pix-fb
|
||||
man libfb
|
||||
-332
@@ -1,332 +0,0 @@
|
||||
/*
|
||||
* util/Cakefile
|
||||
*/
|
||||
|
||||
#define SRCDIR util
|
||||
#define PRODUCTS fbanim loop pix-fb fb-pix \
|
||||
pixbustup pixdiff pixinterp2x pixtile pixuntile \
|
||||
pixflip-fb pixfade \
|
||||
pp-fb fbclear fbgrid \
|
||||
orle-fb fb-orle orle-pix pix-orle \
|
||||
rle-fb fb-rle rle-pix pix-rle \
|
||||
fbcmap fb-cmap cmap-fb fbgamma \
|
||||
fbscanplot fbzoom fbpoint fblabel fbline\
|
||||
pl-fb fbcolor fbcmrot pixbackgnd fbframe ap-pix \
|
||||
bw-fb bw-pix bw3-pix bwcrop bwdiff bwfilter bw-imp bw-ps \
|
||||
bwhist bwhisteq bwmod bwrect bwrot bwscale bwstat fb-bw \
|
||||
gencolor pix-bw pix-bw3 pixfilter pixhist \
|
||||
pixhist3d pixhist3d-pl \
|
||||
pixrect pixrot pixscale pixstat fbcbars \
|
||||
sun-pix mac-pix pixmerge op-bw \
|
||||
pl-sgi pldebug plgetframe plrot \
|
||||
dunncolor dunnsnap cat-fb \
|
||||
buffer files-tape \
|
||||
plcolor plline2 pl-pl pl-ps \
|
||||
spm-fb pix-spm \
|
||||
fbhelp gif2fb pix3filter \
|
||||
fbfade fbstretch gif-fb \
|
||||
pix-sun pix-alias alias-pix pixcolors hd
|
||||
|
||||
#define SRCSUFF .c
|
||||
#define MANSECTION 1
|
||||
|
||||
#include "../Cakefile.defs"
|
||||
#include "../Cakefile.prog"
|
||||
|
||||
/* Explicit composition of each product */
|
||||
|
||||
dunncolor: dunncolor.o dunncomm.o
|
||||
CC LDFLAGS -o dunncolor dunncolor.o dunncomm.o LIBES
|
||||
|
||||
dunnsnap: dunnsnap.o dunncomm.o LIBFB
|
||||
CC LDFLAGS -o dunnsnap dunnsnap.o dunncomm.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbanim: fbanim.o LIBFB
|
||||
CC LDFLAGS -o fbanim fbanim.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pl-fb: pl-fb.o LIBFB
|
||||
CC LDFLAGS -o pl-fb pl-fb.o LIB_PRE''LIBFB LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
loop: loop.o
|
||||
CC LDFLAGS -o loop loop.o LIBES
|
||||
|
||||
mac-pix: mac-pix.o
|
||||
CC LDFLAGS -o mac-pix mac-pix.o LIBES
|
||||
|
||||
sun-pix: sun-pix.o
|
||||
CC LDFLAGS -o sun-pix sun-pix.o LIBES
|
||||
|
||||
pixmerge: pixmerge.o
|
||||
CC LDFLAGS -o pixmerge pixmerge.o LIBES
|
||||
|
||||
fbcbars: fbcbars.o LIBFB
|
||||
CC LDFLAGS -o fbcbars fbcbars.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pix-fb: pix-fb.o LIBFB
|
||||
CC LDFLAGS -o pix-fb pix-fb.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fb-pix: fb-pix.o linear-cmap.o cmap-crunch.o LIBFB
|
||||
CC LDFLAGS -o fb-pix fb-pix.o linear-cmap.o cmap-crunch.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pixbustup: pixbustup.o
|
||||
CC LDFLAGS -o pixbustup pixbustup.o LIBES
|
||||
|
||||
/* The difficulty here is obtaining the random number tables */
|
||||
pixfade: pixfade.o
|
||||
CC LDFLAGS -o pixfade pixfade.o CFLAGS ../rt/mathtab.c LIBES
|
||||
|
||||
pixdiff: pixdiff.o
|
||||
CC LDFLAGS -o pixdiff pixdiff.o LIBES
|
||||
|
||||
pixinterp2x: pixinterp2x.o
|
||||
CC LDFLAGS -o pixinterp2x pixinterp2x.o LIBES
|
||||
|
||||
pixtile: pixtile.o
|
||||
CC LDFLAGS -o pixtile pixtile.o LIBES
|
||||
|
||||
pixflip-fb: pixflip-fb.o LIBFB
|
||||
CC LDFLAGS -o pixflip-fb pixflip-fb.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pixuntile: pixuntile.o
|
||||
CC LDFLAGS -o pixuntile pixuntile.o LIBES
|
||||
|
||||
pp-fb: pp-fb.o LIBFB LIBTERMIO
|
||||
CC LDFLAGS -o pp-fb pp-fb.o LIB_PRE''LIBFB LIBTERMIO LIBES
|
||||
|
||||
fbclear: fbclear.o LIBFB
|
||||
CC LDFLAGS -o fbclear fbclear.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbhelp: fbhelp.o LIBFB
|
||||
CC LDFLAGS -o fbhelp fbhelp.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbgrid: fbgrid.o LIBFB
|
||||
CC LDFLAGS -o fbgrid fbgrid.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
/* Old RLE Programs (Utah format Edition 2) */
|
||||
|
||||
orle-fb: orle-fb.o LIBFB LIBORLE
|
||||
CC LDFLAGS -o orle-fb orle-fb.o LIB_PRE''LIBFB LIBORLE LIBES
|
||||
|
||||
fb-orle: fb-orle.o linear-cmap.o cmap-crunch.o LIBFB LIBORLE
|
||||
CC LDFLAGS -o fb-orle fb-orle.o linear-cmap.o cmap-crunch.o LIB_PRE''LIBFB LIB_PRE''LIBORLE LIBES
|
||||
|
||||
orle-pix: orle-pix.o linear-cmap.o LIBORLE
|
||||
CC LDFLAGS -o orle-pix orle-pix.o linear-cmap.o LIB_PRE''LIBORLE LIBES
|
||||
|
||||
pix-orle: pix-orle.o LIBORLE
|
||||
CC LDFLAGS -o pix-orle pix-orle.o LIB_PRE''LIBORLE LIBES
|
||||
|
||||
/* New RLE Programs (Utah format Edition 3) -- matches Utah Raster Toolkit */
|
||||
|
||||
/*** oldtonewrle.c ? */
|
||||
|
||||
rle-fb: rle-fb.o LIBFB LIBRLE
|
||||
CC LDFLAGS -o rle-fb rle-fb.o LIB_PRE''LIBFB LIB_PRE''LIBRLE LIBES
|
||||
|
||||
fb-rle: fb-rle.o strdup.o cmap-crunch.o linear-cmap.o LIBFB LIBRLE
|
||||
CC LDFLAGS -o fb-rle fb-rle.o strdup.o cmap-crunch.o linear-cmap.o LIB_PRE''LIBFB LIB_PRE''LIBRLE LIBES
|
||||
|
||||
rle-pix: rle-pix.o strdup.o LIBRLE
|
||||
CC LDFLAGS -o rle-pix rle-pix.o strdup.o LIB_PRE''LIBRLE LIBES
|
||||
|
||||
pix-rle: pix-rle.o strdup.o LIBRLE
|
||||
CC LDFLAGS -o pix-rle pix-rle.o strdup.o LIB_PRE''LIBRLE LIBES
|
||||
|
||||
fbcmap: fbcmap.o LIBFB
|
||||
CC LDFLAGS -o fbcmap fbcmap.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fb-cmap: fb-cmap.o LIBFB
|
||||
CC LDFLAGS -o fb-cmap fb-cmap.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
cmap-fb: cmap-fb.o LIBFB
|
||||
CC LDFLAGS -o cmap-fb cmap-fb.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbgamma: fbgamma.o LIBFB
|
||||
CC LDFLAGS -o fbgamma fbgamma.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbscanplot: fbscanplot.o LIBFB
|
||||
CC LDFLAGS -o fbscanplot fbscanplot.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbzoom: fbzoom.o LIBFB LIBTERMIO
|
||||
CC LDFLAGS -o fbzoom fbzoom.o LIB_PRE''LIBFB LIBTERMIO LIBES
|
||||
|
||||
fbpoint: fbpoint.o LIBFB LIBTERMIO
|
||||
CC LDFLAGS -o fbpoint fbpoint.o LIB_PRE''LIBFB LIBTERMIO LIBES
|
||||
|
||||
fblabel: fblabel.o LIBFB LIBFONT
|
||||
CC LDFLAGS -o fblabel fblabel.o LIB_PRE''LIBFONT LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbline: fbline.o LIBFB
|
||||
CC LDFLAGS -o fbline fbline.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbcolor: fbcolor.o LIBFB LIBTERMIO
|
||||
CC LDFLAGS -o fbcolor fbcolor.o LIB_PRE''LIBFB LIBTERMIO LIBES
|
||||
|
||||
ap-pix: ap-pix.o
|
||||
CC LDFLAGS -o ap-pix ap-pix.o LIBES
|
||||
|
||||
fbcmrot: fbcmrot.o LIBFB
|
||||
CC LDFLAGS -o fbcmrot fbcmrot.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pixbackgnd: pixbackgnd.o
|
||||
CC LDFLAGS -o pixbackgnd pixbackgnd.o LIBES
|
||||
|
||||
fbframe: fbframe.o LIBFB
|
||||
CC LDFLAGS -o fbframe fbframe.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
bw-fb: bw-fb.o LIBFB
|
||||
CC LDFLAGS -o bw-fb bw-fb.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
bw-imp: bw-imp.o
|
||||
CC LDFLAGS -o bw-imp bw-imp.o LIBES
|
||||
|
||||
bw-ps: bw-ps.o
|
||||
CC LDFLAGS -o bw-ps bw-ps.o LIBES
|
||||
|
||||
bw-pix: bw-pix.o
|
||||
CC LDFLAGS -o bw-pix bw-pix.o LIBES
|
||||
|
||||
bw3-pix: bw3-pix.o
|
||||
CC LDFLAGS -o bw3-pix bw3-pix.o LIBES
|
||||
|
||||
bwcrop: bwcrop.o
|
||||
CC LDFLAGS -o bwcrop bwcrop.o LIBES
|
||||
|
||||
bwdiff: bwdiff.o
|
||||
CC LDFLAGS -o bwdiff bwdiff.o LIBES
|
||||
|
||||
bwfilter: bwfilter.o
|
||||
CC LDFLAGS -o bwfilter bwfilter.o LIBES
|
||||
|
||||
bwhist: bwhist.o LIBFB
|
||||
CC LDFLAGS -o bwhist bwhist.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
bwhisteq: bwhisteq.o
|
||||
CC LDFLAGS -o bwhisteq bwhisteq.o LIBES
|
||||
|
||||
bwmod: bwmod.o
|
||||
CC LDFLAGS -o bwmod bwmod.o LIBES
|
||||
|
||||
bwrect: bwrect.o
|
||||
CC LDFLAGS -o bwrect bwrect.o LIBES
|
||||
|
||||
bwrot: bwrot.o
|
||||
CC LDFLAGS -o bwrot bwrot.o LIBES
|
||||
|
||||
bwscale: bwscale.o
|
||||
CC LDFLAGS -o bwscale bwscale.o LIBES
|
||||
|
||||
bwstat: bwstat.o
|
||||
CC LDFLAGS -o bwstat bwstat.o LIBES
|
||||
|
||||
fb-bw: fb-bw.o LIBFB
|
||||
CC LDFLAGS -o fb-bw fb-bw.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
gencolor: gencolor.o
|
||||
CC LDFLAGS -o gencolor gencolor.o LIBES
|
||||
|
||||
pix-bw: pix-bw.o
|
||||
CC LDFLAGS -o pix-bw pix-bw.o LIBES
|
||||
|
||||
pix-bw3: pix-bw3.o
|
||||
CC LDFLAGS -o pix-bw3 pix-bw3.o LIBES
|
||||
|
||||
pixfilter: pixfilter.o
|
||||
CC LDFLAGS -o pixfilter pixfilter.o LIBES
|
||||
|
||||
pixhist: pixhist.o LIBFB
|
||||
CC LDFLAGS -o pixhist pixhist.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pixhist3d: pixhist3d.o LIBFB
|
||||
CC LDFLAGS -o pixhist3d pixhist3d.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pixrect: pixrect.o
|
||||
CC LDFLAGS -o pixrect pixrect.o LIBES
|
||||
|
||||
pixrot: pixrot.o
|
||||
CC LDFLAGS -o pixrot pixrot.o LIBES
|
||||
|
||||
pixscale: pixscale.o
|
||||
CC LDFLAGS -o pixscale pixscale.o LIBES
|
||||
|
||||
pixstat: pixstat.o
|
||||
CC LDFLAGS -o pixstat pixstat.o LIBES
|
||||
|
||||
pixhist3d-pl: pixhist3d-pl.o LIBPLOT
|
||||
CC LDFLAGS -o pixhist3d-pl pixhist3d-pl.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
pl-sgi: pl-sgi.o LIBPLOT LIBFB
|
||||
CC LDFLAGS -o pl-sgi pl-sgi.o LIB_PRE''LIBPLOT LIB_PRE''LIBFB LIBES
|
||||
|
||||
pl-ps: pl-ps.o LIBPLOT
|
||||
CC LDFLAGS -o pl-ps pl-ps.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
pldebug: pldebug.o LIBPLOT
|
||||
CC LDFLAGS -o pldebug pldebug.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
plgetframe: plgetframe.o LIBPLOT
|
||||
CC LDFLAGS -o plgetframe plgetframe.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
plrot: plrot.o LIBPLOT
|
||||
CC LDFLAGS -o plrot plrot.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
op-bw: op-bw.o
|
||||
CC LDFLAGS -o op-bw op-bw.o LIBES
|
||||
|
||||
cat-fb: cat-fb.o LIBFONT LIBFB
|
||||
CC LDFLAGS -o cat-fb cat-fb.o LIB_PRE''LIBFONT LIB_PRE''LIBFB LIBES
|
||||
|
||||
plcolor: plcolor.o LIBPLOT
|
||||
CC LDFLAGS -o plcolor plcolor.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
plline2: plline2.o LIBPLOT
|
||||
CC LDFLAGS -o plline2 plline2.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
pl-pl: pl-pl.o LIBPLOT
|
||||
CC LDFLAGS -o pl-pl pl-pl.o LIB_PRE''LIBPLOT LIBES
|
||||
|
||||
buffer: buffer.o
|
||||
CC LDFLAGS -o buffer buffer.o LIBES
|
||||
|
||||
files-tape: files-tape.o
|
||||
CC LDFLAGS -o files-tape files-tape.o LIBES
|
||||
|
||||
/* "gif2fb" is an alternative implementation of "gif-fb"; use either or both */
|
||||
|
||||
gif2fb: gif2fb.o LIBFB
|
||||
CC LDFLAGS -o gif2fb gif2fb.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
pix3filter: pix3filter.o
|
||||
CC LDFLAGS -o pix3filter pix3filter.o LIBES
|
||||
|
||||
fbfade: fbfade.o LIBFB
|
||||
CC LDFLAGS -o fbfade fbfade.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
fbstretch: fbstretch.o LIBFB
|
||||
CC LDFLAGS -o fbstretch fbstretch.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
gif-fb: gif-fb.o LIBFB
|
||||
CC LDFLAGS -o gif-fb gif-fb.o LIB_PRE''LIBFB LIBES
|
||||
|
||||
spm-fb: spm-fb.o LIBRT LIBFB
|
||||
CC LDFLAGS -o spm-fb spm-fb.o LIB_PRE''LIBRT LIB_PRE''LIBFB RT_LIBES LIBES
|
||||
|
||||
pix-spm: pix-spm.o LIBRT
|
||||
CC LDFLAGS -o pix-spm pix-spm.o LIB_PRE''LIBRT RT_LIBES LIBES
|
||||
|
||||
pix-sun: pix-sun.o
|
||||
CC LDFLAGS -o pix-sun pix-sun.o LIBES
|
||||
|
||||
pix-alias: pix-alias.o
|
||||
CC LDFLAGS -o pix-alias pix-alias.o LIBES
|
||||
|
||||
alias-pix: alias-pix.o
|
||||
CC LDFLAGS -o alias-pix alias-pix.o LIBES
|
||||
|
||||
pixcolors: pixcolors.o
|
||||
CC LDFLAGS -o pixcolors pixcolors.o LIBES
|
||||
|
||||
hd: hd.o
|
||||
CC LDFLAGS -o hd hd.o LIBES
|
||||
|
||||
#include "../Cakefile.rules"
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
.TH BW-FB 1 BRL/CAD
|
||||
.SH NAME
|
||||
bw\(hyfb \- display a black and white bw image on a framebuffer
|
||||
.SH SYNOPSIS
|
||||
.B bw-fb
|
||||
.RB [ \-hiczRGB ]
|
||||
.RB [ \-F\ framebuffer]
|
||||
.RB [ \-s\ squarefilesize]
|
||||
.RB [ \-w\ file_width]
|
||||
.RB [ \-n\ file_height]
|
||||
.RB [ \-S\ squarescrsize]
|
||||
.RB [ \-W\ scr_width]
|
||||
.RB [ \-N\ scr_height]
|
||||
.RB [ \-x\ file_xoff]
|
||||
.RB [ \-y\ file_yoff]
|
||||
.RB [ \-X\ scr_xoff]
|
||||
.RB [ \-Y\ src_yoff]
|
||||
\<\ file.bw
|
||||
.SH DESCRIPTION
|
||||
.I Bw-fb
|
||||
reads a
|
||||
.IR bw (5)
|
||||
format file
|
||||
from standard input, and displays the
|
||||
image on the currently selected framebuffer.
|
||||
The environment variable
|
||||
.I FB_FILE
|
||||
specifies
|
||||
the current framebuffer, see
|
||||
.IR brlcad (1).
|
||||
Alternatively, the framebuffer may be explicitly specified
|
||||
by using the
|
||||
.B \-F
|
||||
flag.
|
||||
.PP
|
||||
By default, the
|
||||
.I bw
|
||||
file, and the requested framebuffer size, is assumed to be 512x512 pixels.
|
||||
Specifying the
|
||||
.B \-h
|
||||
flag changes both of these sizes to 1024x1024.
|
||||
.PP
|
||||
If the
|
||||
.B \-i
|
||||
flag is specified, the image is output from top to bottom.
|
||||
Customarily,
|
||||
.I bw
|
||||
files are stored bottom to top, so this
|
||||
inverts the image.
|
||||
.PP
|
||||
The
|
||||
.B \-c
|
||||
flag causes the screen to be cleared before the image is displayed.
|
||||
The default behavior is to overwrite the current image
|
||||
with the new image without clearing the screen.
|
||||
.PP
|
||||
The
|
||||
.B \-z
|
||||
flag will zoom and center on the image being displayed
|
||||
to make it fill the display area.
|
||||
.PP
|
||||
The flags
|
||||
.BR \-R , \ \-G ,\ and \ \-B
|
||||
select individual color planes into which the image will be loaded.
|
||||
One or more can be given. By default all three colors are written
|
||||
with the
|
||||
.I bw
|
||||
pixel value.
|
||||
.PP
|
||||
The
|
||||
.BR \-w\ file_width
|
||||
flag specifies the width of each scanline in the input file, in pixels.
|
||||
.BR \-W\ scr_width
|
||||
does the same for the display device.
|
||||
.PP
|
||||
The
|
||||
.BR \-n\ file_height
|
||||
and
|
||||
.BR \-N\ scr_height
|
||||
flags specify the height in scanlines of the input file or display device
|
||||
respectively.
|
||||
.PP
|
||||
.BR \-s\ squarefilesize
|
||||
and
|
||||
.BR \-S\ squarescrsize
|
||||
set both the height and width to the size given.
|
||||
.PP
|
||||
.BR \-x\ file_xoff,
|
||||
.BR \-y\ file_yoff,
|
||||
.BR \-X\ scr_xoff,
|
||||
and
|
||||
.BR \-Y\ scr_yoff
|
||||
will offset into the file or onto the screen by the given amounts.
|
||||
The coordinate system for these offsets is first quadrant, with
|
||||
the origin at the lower left corner of the image.
|
||||
.SH "FORMAT"
|
||||
A
|
||||
.IR bw (5)
|
||||
file contains sequences of pixels.
|
||||
Each pixel is stored as one
|
||||
.B unsigned char
|
||||
The first pixel in a
|
||||
.I bw
|
||||
file is the lower left corner of the image.
|
||||
The pixels proceed from left-to-right across each scanline,
|
||||
with scanlines being written from the bottom to the top of the image.
|
||||
.SH "SEE ALSO"
|
||||
fb-bw(1), bw(5)
|
||||
.SH AUTHOR
|
||||
Phillip Dykstra
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@BRL.MIL>.
|
||||
-305
@@ -1,305 +0,0 @@
|
||||
/*
|
||||
* B W - F B . C
|
||||
*
|
||||
* Write a black and white (.bw) image to the framebuffer.
|
||||
* From an 8-bit/pixel, pix order file (i.e. Bottom UP, left to right).
|
||||
*
|
||||
* This allows an offset into both the display and source file.
|
||||
* The color planes to be loaded are also selectable.
|
||||
*
|
||||
* Author -
|
||||
* Phillip Dykstra
|
||||
* 15 Aug 1985
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1986 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "fb.h"
|
||||
|
||||
extern int getopt();
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
#define MAX_LINE (16*1024) /* Largest output scan line length */
|
||||
|
||||
static char ibuf[MAX_LINE];
|
||||
static RGBpixel obuf[MAX_LINE];
|
||||
|
||||
static int fileinput = 0; /* file of pipe on input? */
|
||||
|
||||
static int file_width = 512; /* default input width */
|
||||
static int file_height = 512; /* default input height */
|
||||
static int scr_width = 0; /* screen tracks file if not given */
|
||||
static int scr_height = 0;
|
||||
static int file_xoff, file_yoff;
|
||||
static int scr_xoff, scr_yoff;
|
||||
static int clear = 0;
|
||||
static int zoom = 0;
|
||||
static int inverse = 0;
|
||||
static int redflag = 0;
|
||||
static int greenflag = 0;
|
||||
static int blueflag = 0;
|
||||
|
||||
static char *framebuffer = NULL;
|
||||
static char *file_name;
|
||||
static int infd;
|
||||
static FBIO *fbp;
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: bw-fb [-h -i -c -z -R -G -B] [-F framebuffer]\n\
|
||||
[-s squarefilesize] [-w file_width] [-n file_height]\n\
|
||||
[-x file_xoff] [-y file_yoff] [-X scr_xoff] [-Y scr_yoff]\n\
|
||||
[-S squarescrsize] [-W scr_width] [-N scr_height] [file.bw]\n";
|
||||
|
||||
get_args( argc, argv )
|
||||
register char **argv;
|
||||
{
|
||||
register int c;
|
||||
|
||||
while ( (c = getopt( argc, argv, "hiczRGBF:s:w:n:x:y:X:Y:S:W:N:" )) != EOF ) {
|
||||
switch( c ) {
|
||||
case 'h':
|
||||
/* high-res */
|
||||
file_height = file_width = 1024;
|
||||
scr_height = scr_width = 1024;
|
||||
break;
|
||||
case 'i':
|
||||
inverse = 1;
|
||||
break;
|
||||
case 'c':
|
||||
clear = 1;
|
||||
break;
|
||||
case 'z':
|
||||
zoom = 1;
|
||||
break;
|
||||
case 'R':
|
||||
redflag = 1;
|
||||
break;
|
||||
case 'G':
|
||||
greenflag = 1;
|
||||
break;
|
||||
case 'B':
|
||||
blueflag = 1;
|
||||
break;
|
||||
case 'F':
|
||||
framebuffer = optarg;
|
||||
break;
|
||||
case 's':
|
||||
/* square file size */
|
||||
file_height = file_width = atoi(optarg);
|
||||
break;
|
||||
case 'w':
|
||||
file_width = atoi(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
file_height = atoi(optarg);
|
||||
break;
|
||||
case 'x':
|
||||
file_xoff = atoi(optarg);
|
||||
break;
|
||||
case 'y':
|
||||
file_yoff = atoi(optarg);
|
||||
break;
|
||||
case 'X':
|
||||
scr_xoff = atoi(optarg);
|
||||
break;
|
||||
case 'Y':
|
||||
scr_yoff = atoi(optarg);
|
||||
break;
|
||||
case 'S':
|
||||
scr_height = scr_width = atoi(optarg);
|
||||
break;
|
||||
case 'W':
|
||||
scr_width = atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
scr_height = atoi(optarg);
|
||||
break;
|
||||
|
||||
default: /* '?' */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
if( optind >= argc ) {
|
||||
if( isatty(fileno(stdin)) )
|
||||
return(0);
|
||||
file_name = "-";
|
||||
infd = 0;
|
||||
} else {
|
||||
file_name = argv[optind];
|
||||
if( (infd = open(file_name, 0)) < 0 ) {
|
||||
(void)fprintf( stderr,
|
||||
"bw-fb: cannot open \"%s\" for reading\n",
|
||||
file_name );
|
||||
return(0);
|
||||
}
|
||||
fileinput++;
|
||||
}
|
||||
|
||||
if ( argc > ++optind )
|
||||
(void)fprintf( stderr, "bw-fb: excess argument(s) ignored\n" );
|
||||
|
||||
return(1); /* OK */
|
||||
}
|
||||
|
||||
main( argc, argv )
|
||||
int argc; char **argv;
|
||||
{
|
||||
register int x, y, n;
|
||||
int xout, yout; /* number of sceen output lines */
|
||||
|
||||
if ( !get_args( argc, argv ) ) {
|
||||
(void)fputs(usage, stderr);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
/* If no color planes were selected, load them all */
|
||||
if( redflag == 0 && greenflag == 0 && blueflag == 0 )
|
||||
redflag = greenflag = blueflag = 1;
|
||||
|
||||
/* If screen size was not set, track the file size */
|
||||
if( scr_width == 0 )
|
||||
scr_width = file_width;
|
||||
if( scr_height == 0 )
|
||||
scr_height = file_height;
|
||||
|
||||
/* Open Display Device */
|
||||
if ((fbp = fb_open( framebuffer, scr_width, scr_height )) == NULL ) {
|
||||
fprintf( stderr, "fb_open failed\n");
|
||||
exit( 3 );
|
||||
}
|
||||
|
||||
/* Get the screen size we were given */
|
||||
scr_width = fb_getwidth(fbp);
|
||||
scr_height = fb_getheight(fbp);
|
||||
|
||||
/* compute pixels output to screen */
|
||||
xout = scr_width - scr_xoff;
|
||||
if( xout < 0 ) xout = 0;
|
||||
if( xout > (file_width-file_xoff) ) xout = (file_width-file_xoff);
|
||||
yout = scr_height - scr_yoff;
|
||||
if( yout < 0 ) yout = 0;
|
||||
if( yout > (file_height-file_yoff) ) yout = (file_height-file_yoff);
|
||||
if( xout > MAX_LINE ) {
|
||||
fprintf( stderr, "bw-fb: can't output %d pixel lines.\n", xout );
|
||||
exit( 2 );
|
||||
}
|
||||
|
||||
if( clear ) {
|
||||
fb_clear( fbp, PIXEL_NULL );
|
||||
}
|
||||
if( zoom ) {
|
||||
/* Zoom in, and center the file */
|
||||
fb_zoom( fbp, scr_width/xout, scr_height/yout );
|
||||
if( inverse )
|
||||
fb_window( fbp, scr_xoff+xout/2, scr_height-1-(scr_yoff+yout/2) );
|
||||
else
|
||||
fb_window( fbp, scr_xoff+xout/2, scr_yoff+yout/2 );
|
||||
}
|
||||
|
||||
if( file_yoff != 0 ) skipbytes( infd, file_yoff*file_width );
|
||||
|
||||
for( y = scr_yoff; y < scr_yoff + yout; y++ ) {
|
||||
if( file_xoff != 0 )
|
||||
skipbytes( infd, file_xoff );
|
||||
n = mread( infd, &ibuf[0], xout );
|
||||
if( n <= 0 ) break;
|
||||
/*
|
||||
* If we are not loading all color planes, we have
|
||||
* to do a pre-read.
|
||||
*/
|
||||
if( redflag == 0 || greenflag == 0 || blueflag == 0 ) {
|
||||
if( inverse )
|
||||
n = fb_read( fbp, scr_xoff, scr_height-1-y,
|
||||
obuf, xout );
|
||||
else
|
||||
n = fb_read( fbp, scr_xoff, y, obuf, xout );
|
||||
if( n < 0 ) break;
|
||||
}
|
||||
for( x = 0; x < xout; x++ ) {
|
||||
if( redflag )
|
||||
obuf[x][RED] = ibuf[x];
|
||||
if( greenflag )
|
||||
obuf[x][GRN] = ibuf[x];
|
||||
if( blueflag )
|
||||
obuf[x][BLU] = ibuf[x];
|
||||
}
|
||||
if( inverse )
|
||||
fb_write( fbp, scr_xoff, scr_height-1-y, obuf, xout );
|
||||
else
|
||||
fb_write( fbp, scr_xoff, y, obuf, xout );
|
||||
|
||||
/* slop at the end of the line? */
|
||||
if( xout < file_width-file_xoff )
|
||||
skipbytes( infd, file_width-file_xoff-xout );
|
||||
}
|
||||
|
||||
fb_close( fbp );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Throw bytes away. Use reads into ibuf buffer if a pipe, else seek.
|
||||
*/
|
||||
skipbytes( fd, num )
|
||||
int fd;
|
||||
long num;
|
||||
{
|
||||
int n, try;
|
||||
|
||||
if( fileinput ) {
|
||||
(void)lseek( fd, num, 1 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
while( num > 0 ) {
|
||||
try = num > MAX_LINE ? MAX_LINE : num;
|
||||
n = read( fd, ibuf, try );
|
||||
if( n <= 0 ){
|
||||
return -1;
|
||||
}
|
||||
num -= n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* "Multiple try" read.
|
||||
* Will keep reading until either an error occurs
|
||||
* or the requested number of bytes is read. This
|
||||
* is important for pipes.
|
||||
*/
|
||||
mread( fd, bp, num )
|
||||
int fd;
|
||||
register char *bp;
|
||||
register int num;
|
||||
{
|
||||
register int n;
|
||||
int count;
|
||||
|
||||
count = 0;
|
||||
|
||||
while( num > 0 ) {
|
||||
n = read( fd, bp, num );
|
||||
if( n < 0 )
|
||||
return -1;
|
||||
if( n == 0 )
|
||||
return count;
|
||||
bp += n;
|
||||
count += n;
|
||||
num -= n;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user