Compare commits

...
Author SHA1 Message Date
cvs-fast-export 2309a9d835 Synthetic commit for incomplete tag rel-5-2
svn:revision:19376
cvs:account:cvs-fast-export
2000-09-11 19:55:01 +00:00
John Anderson 58b9a2eb7f Replaced accidentally removed "usage" declaration.
svn:revision:19375
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-11 19:55:01 +00:00
John Anderson 4866110986 Hack to get "struct timeval" defined and "select" call to compile under Irix 5.3
svn:revision:19374
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-11 19:54:07 +00:00
John Anderson aad8f1616f Hack to get "struct timeval" defined under IRIX 5.3
svn:revision:19373
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-11 19:52:55 +00:00
John Anderson 340790bfd4 7d was trying to combine n32 and o32 flags
svn:revision:19371
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-11 17:02:13 +00:00
John Anderson 3479aaf5c6 Moved LIBTCLHOOKS_LIBES into Shared libraru sections only
svn:revision:19367
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-10 22:15:23 +00:00
John Anderson 5d78682fcd Solaris chown doesn't take groups
Reset release date for 5.2

svn:revision:19320
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-07 18:49:03 +00:00
Robert Parker 594a193a70 Mods to 7d's LIBTCLHOOKS_LIBES definition
svn:revision:19289
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-05 15:19:40 +00:00
John Anderson c64c0dff3d Added DBV4_NON_REGION_NULL flag for combinations
svn:revision:19288
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-05 12:45:12 +00:00
Robert Parker 79c3789117 Add default for LIBTCLHOOKS_CONFIG
svn:revision:19286
cvs:branch:rel-5-1-branch
cvs:account:bparker
2000-09-01 21:39:00 +00:00
Robert Parker bbbeab4e0e Modified 6d's LIBTCLHOOKS_LIBES definition
svn:revision:19285
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 21:28:36 +00:00
Robert Parker 773f88b16e Add LIBTCLHOOKS_LIBES to other sgi platforms
svn:revision:19283
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 19:33:03 +00:00
Robert Parker f38937c82e Add LIBTCLHOOKS_LIBES to m4i62 and m4i64
svn:revision:19282
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 19:25:00 +00:00
Robert Parker d921cdda2c Add tcl to FILES.
svn:revision:19278
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:36:00 +00:00
Robert Parker b4742616c6 dm_open has new signature (i.e. interp)
svn:revision:19277
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:31:46 +00:00
Robert Parker ee6d373289 Modified Rt_Init to initialize RT's global state.
svn:revision:19276
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:30:33 +00:00
Robert Parker 967bf286ef libpkg's tcl interface.
svn:revision:19273
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:26:11 +00:00
Robert Parker 4840602e6d Removed two globals: interp and tkwin
svn:revision:19272
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:24:43 +00:00
Robert Parker b1752d426a Moved interp member.
svn:revision:19271
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:23:14 +00:00
Robert Parker ff7d392cc9 Add libtclhooks.
svn:revision:19270
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-09-01 17:22:39 +00:00
John Anderson 8b4f41df0e Improved bot_fuse() to run faster and delete excess vertices as it goes
svn:revision:19268
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-01 14:35:17 +00:00
John Anderson 087472f289 Added poly-bot
svn:revision:19267
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-01 14:30:25 +00:00
John Anderson 9b5e403f45 Initial version of code to convert all the polysolids in a model to BOT's
svn:revision:19266
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-09-01 14:30:12 +00:00
Robert Parker 0466389063 Fixed typo in use of dgo_invent_solid().
Call dgo_notify() after dgo_invent_solid().

svn:revision:19214
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-08-30 17:30:11 +00:00
Robert Parker 0ff9ae3300 Remove static specifier from dgo_notify declaration.
svn:revision:19213
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-08-30 17:26:15 +00:00
Robert Parker b2a332d671 Don't draw wireframe if overlaying entire window
with framebuffer pixels.

svn:revision:19212
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-08-30 17:22:13 +00:00
John Anderson ddbebc32e2 Fixed a bug in rt_fastgen_vol_vol_overlap()
svn:revision:19211
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-30 14:56:02 +00:00
John Anderson c5c9ce5b41 Fixed a bug in bn_distsq_line3_line3()
svn:revision:19184
cvs:branch:rel-5-1-branch
cvs:account:jra
2000-08-25 12:59:59 +00:00
John Anderson f5d206da94 db_open was clobbering dbip->dbi_eof with an "initialization"
svn:revision:19143
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-24 17:40:07 +00:00
John Anderson 03fe58f9c7 rt_bot_minpieces is an int, not a float
svn:revision:19142
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-24 13:34:38 +00:00
John Anderson f2c7943f1e changed hit check to allow hits exactly on ends of cline
svn:revision:19141
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-24 13:32:52 +00:00
John Anderson ad6cb24be0 bn_distsq_line3_line3() corrected by unitizing direction vectors
svn:revision:19140
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-24 13:29:28 +00:00
John Anderson d7b0af2695 Default for 7d is now o32
svn:revision:19076
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-22 15:08:58 +00:00
John Anderson 593d560200 Eliminated redefinition of a type from sys/types.h
svn:revision:19074
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-22 13:59:24 +00:00
John Anderson 702920b586 Eliminated some duplication in the source distribution files
svn:revision:19073
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-22 13:09:55 +00:00
John Anderson c0da83664f Fixed source distribution code
svn:revision:19072
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-22 13:01:08 +00:00
John Anderson 1d4a06d89b reorder libraries
svn:revision:19067
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-21 16:56:39 +00:00
John Anderson 4e256654c5 Added Olimit 200 option for m4i64 (-o32)
svn:revision:19066
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-21 16:25:11 +00:00
John Anderson ac06cd3e17 Set release to 5.2
svn:revision:19065
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-21 14:26:32 +00:00
John Anderson 2243fbb2a8 Fixed dist target to handle libitcl correctly and refuse to run under IRIX
svn:revision:19047
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 20:51:03 +00:00
John Anderson ff6162601f Eliminated FBSD option to use system libtcl and libtk (it doesn't work)
svn:revision:19044
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 18:54:25 +00:00
John Anderson dd8b6865c8 protected declaration of sync() (normally declared in unistd.h)
svn:revision:19043
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 13:52:13 +00:00
John Anderson 3d72955b37 Updated to latest revision
svn:revision:19042
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 13:51:14 +00:00
John Anderson c382a46549 Updated fbserv to latest revision
svn:revision:19041
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 13:50:51 +00:00
John Anderson 7c27f81aa0 A single hit is now silently ignored
svn:revision:19040
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 12:44:51 +00:00
John Anderson c2cc010d98 Updated Linux entry
svn:revision:19039
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-18 12:44:17 +00:00
John Anderson 9bdfcff08b Linux has unistd.h
svn:revision:19033
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-17 20:12:08 +00:00
John Anderson 58b8001334 Added -u option for output units
svn:revision:19027
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-17 18:24:41 +00:00
John Anderson 9302470016 Added support for BOT plate mode objects
svn:revision:19022
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-17 15:24:38 +00:00
John Anderson a72e560a18 Add tesellation support
svn:revision:19021
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-17 15:23:52 +00:00
John Anderson 34ba606706 DLOPEN support
svn:revision:19016
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-17 13:00:36 +00:00
Robert Parker 24276053c2 moved from cwish
svn:revision:19004
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-08-16 18:00:43 +00:00
Robert Parker 943ec3c4d1 cwish becomes/replaces bwish
svn:revision:19003
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-08-16 17:59:19 +00:00
Robert Parker 4b20b2c375 cwish becomes/replaces bwish
svn:revision:18999
cvs:branch:rel-5-1-branch
cvs:account:bparker
2000-08-16 17:46:59 +00:00
Robert Parker 22c70e45fe Make use of Help object.
svn:revision:18994
cvs:account:bparker
cvs:branch:rel-5-1-branch
2000-08-16 17:02:25 +00:00
Robert Parker 5bfd48ed30 Adding classes from main branch of source tree.
svn:revision:18992
svn:revision:18993
cvs:account:bparker
cvs:branch:rel-5-2
2000-08-16 16:56:03 +00:00
John Anderson 48762691ac Eliminated some unused variables
svn:revision:18982
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-15 18:39:06 +00:00
John Anderson 1e7d3d3346 Needed ap_logoverlap pointer set to silent logging
svn:revision:18979
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-15 17:59:07 +00:00
John Anderson dd2f7ff757 Improved detection of collinear pipe points
svn:revision:18978
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-15 17:54:39 +00:00
John Anderson 882c9bb7f2 Added cas for DBV4_NON_REGION_NULL in rt_comb_import()
svn:revision:18977
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-15 14:22:28 +00:00
John Anderson 31d7426d92 Added define for DBV4_NON_REGION_NULL
svn:revision:18976
cvs:account:jra
cvs:branch:rel-5-1-branch
2000-08-15 14:20:33 +00:00
John Anderson 156fb2ba97 Fixed a bug in the subtracted region expansion code
svn:revision:18835
cvs:account:jra
cvs:branch:brlcad_5_1_alpha_patch
2000-07-13 19:07:33 +00:00
218 changed files with 6453 additions and 16203 deletions
+66 -72
View File
@@ -194,9 +194,10 @@ set -S2 "/bin/sh"
# define LIBFB_LIBES LIBPKG -L''XLIBDIR -lX11 -lgl -lGL
# define LIBDM_LIBES LIBTK LIBTCL LIBTK_LIBES LIBTCL_LIBES
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -lgl -lGL
# define CWISH_CONFIG -I''XINCDIR
# define CWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# define LIBTCLHOOKS_LIBES -lmalloc -lXi -lXext -lgl -lGL
# else
/* Static linked executables */
# define GFLAG
@@ -214,8 +215,8 @@ set -S2 "/bin/sh"
# define LIBDM_LIBES LIBTK LIBTCL LIBTK_LIBES LIBTCL_LIBES
# define LIBFB_LIBES LIBPKG -L''XLIBDIR -lX11 -lgl_s -lGL
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# endif
@@ -224,7 +225,6 @@ set -S2 "/bin/sh"
# define LGT_CONFIG GFLAG
# define LIBFB_OBJS if_remote if_ab if_4d if_X if_X24 if_ogl
# define LIBFB_CONFIG -DIF_REMOTE -DIF_AB -DIF_4D -DIF_5D -DIF_OGL -DBSD=43 -DIF_X -I''XINCDIR
# define LIBMESA_CONFIG -DFBIND=2
# define LIBDM_OBJS dm-X dm-ogl
# define LIBDM_CONFIG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_X -DDM_OGL -DUSE_RT_ASPECT
@@ -251,39 +251,38 @@ set -S2 "/bin/sh"
/* Warning 1048 WAS "cast between pointer-to-object and pointer-to-function */
/* Warning 1110 is "statement is unreachable" */
/* Warning 1048 is "cast between pointer-to-object and pointer-to-function" */
# define OPTIMIZER -O3 \
-OPT:Olimit=4096 \
-OPT:const_copy_limit=16000 \
-use_readonly_const \
-woff 1203
# define OPTIMIZER -O2 \
-Olimit 2000 \
-use_readonly_const
# else
/* This version for debugging with DBX */
/* -fullwarn is pretty verbose */
# define OPTIMIZER -g -use_readonly_const
# endif
# define GFLAG -n32 -mips4 -KPIC -G 7
# define GFLAG -o32 -KPIC -G 0
# define XINCDIR /usr/include/X11
# define XLIBDIR /usr/lib32
# define XLIBDIR /usr/lib
# if 1 /* PRODUCTION=1 */
/* Shared library version support */
# define ARCH_SUF so
# define LIBVERS ../sh/sharedlibvers.sh
# define BUILD_LIBRARY ld -mips4 -shared -o
# define LDSHARED ld -o32 -shared
# define BUILD_LIBRARY LDSHARED -o
# define RANLIB true
# define STANDARD_LIBES -lm -lmalloc -lc -rpath LIBDIR:/usr/lib32
# define STANDARD_LIBES -lm -lmalloc -lc -rpath LIBDIR:/usr/lib
/* When debugging libraries, -m and -v are helpful LD_OPTS */
/* Warning 84: library not used for resolving any symbol */
/* Warning 85: definition in one library preempts that in another */
/* Warning 134: weak definition in one library preempts that in another */
# define LD_OPTS GFLAG -Wl,-woff,84 -Wl,-woff,85 -Wl,-woff,134
# define LIBTCLHOOKS_LIBES -lGL -lXi -lXext
# else
/* Static linked executables */
# define RANLIB ranlib5.sh
# define STANDARD_LIBES -n32 -lm -lmalloc -lc
# define LD_OPTS -n32 GFLAG -Wl,-woff,84 -Wl,-woff,85 -Wl,-woff,134
# define STANDARD_LIBES -o32 -lm -lmalloc -lc
# endif
# define LD_OPTS GFLAG
/* -ansiposix ANSI+POSIX mode is used over ANSI, to get fdopen(), etc, defined. */
# define CC_OPTS GFLAG -xansi -DIRIX=6 -Wl,-woff,1048
# define CC_OPTS GFLAG -xansi -DIRIX=6
# define LGT_CONFIG GFLAG
# define LIBFB_OBJS if_remote if_ab if_X if_X24 if_ogl
# define LIBFB_CONFIG -DIF_REMOTE -DIF_AB -DBSD=43 -DIF_X -I''XINCDIR -DIF_OGL
@@ -294,8 +293,8 @@ set -S2 "/bin/sh"
# define MGED_OBJS dm-X dm-ogl dm-generic
# define MGED_CONFIG GFLAG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_X -DDM_OGL -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# define HAS_TCP 1
# define CC cc
@@ -351,6 +350,7 @@ set -S2 "/bin/sh"
# define STANDARD_LIBES -lm -lmalloc -lc -rpath LIBDIR:/usr/lib64
/* When debugging libraries, -m and -v are helpful LD_OPTS */
# define LD_OPTS GFLAG -Wl,-woff,84 -Wl,-woff,85
# define LIBTCLHOOKS_LIBES -lmalloc -lGL -lXi -lXext
# else
/* Static linked executables */
# define RANLIB ranlib5.sh
@@ -368,8 +368,8 @@ set -S2 "/bin/sh"
# define MGED_OBJS dm-X dm-ogl dm-generic
# define MGED_CONFIG GFLAG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_X -DDM_OGL -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# define HAS_TCP 1
# define CC cc
@@ -419,6 +419,7 @@ set -S2 "/bin/sh"
# define STANDARD_LIBES -lm -lmalloc -lc -rpath LIBDIR:/usr/lib64
/* When debugging libraries, -m and -v are helpful LD_OPTS */
# define LD_OPTS GFLAG -Wl,-woff,84 -Wl,-woff,85
# define LIBTCLHOOKS_LIBES -lmalloc -lGL -lXi -lXext
# else
/* Static linked executables */
# define RANLIB ranlib5.sh
@@ -436,8 +437,8 @@ set -S2 "/bin/sh"
# define MGED_OBJS dm-X dm-ogl dm-generic
# define MGED_CONFIG GFLAG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_X -DDM_OGL -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# define HAS_TCP 1
# define CC cc
@@ -486,7 +487,7 @@ set -S2 "/bin/sh"
-woff 1429,1203,1048,1110,1412,1167,1209 \
-Wl,-w
# else
# define OPTIMIZER -O2 \
# define OPTIMIZER -O2 -Olimit 2000 \
-use_readonly_const \
-woff 1429,1203,1048,1110,1412,1167,1209 \
-Wl,-w
@@ -534,6 +535,7 @@ set -S2 "/bin/sh"
/* When debugging libraries, -m and -v are helpful LD_OPTS */
# define LD_OPTS GFLAG -Wl,-multigot -Wl,-woff,84 -Wl,-woff,85 -Wl,-woff,134
# define CC_OPTS GFLAG -xansi -DIRIX=6 -DIRIX64=64
# define LIBTCLHOOKS_LIBES -lmalloc -lGL -lXi -lXext
# else
/* Static linked executables */
# define RANLIB ranlib5.sh
@@ -553,8 +555,8 @@ set -S2 "/bin/sh"
# define MGED_OBJS dm-X dm-ogl dm-generic
# define MGED_CONFIG GFLAG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_X -DDM_OGL -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# define HAS_TCP 1
# define CC cc
@@ -604,6 +606,7 @@ set -S2 "/bin/sh"
# define STANDARD_LIBES -lm -lmalloc -lc -rpath LIBDIR:/usr/lib64
/* When debugging libraries, -m and -v are helpful LD_OPTS */
# define LD_OPTS GFLAG -Wl,-woff,84 -Wl,-woff,85 -Wl,-woff,134
# define LIBTCLHOOKS_LIBES -lmalloc -lGL -lXi -lXext
# else
/* Static linked executables */
# define RANLIB ranlib5.sh
@@ -621,8 +624,8 @@ set -S2 "/bin/sh"
# define MGED_OBJS dm-X dm-ogl dm-generic
# define MGED_CONFIG GFLAG -DIR_KNOBS=8 -DIR_BUTTONS=32 -DDM_X -DDM_OGL -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# define HAS_TCP 1
# define CC cc
@@ -678,8 +681,8 @@ set -S2 "/bin/sh"
# define MGED_OBJS dm-X dm-generic
# define MGED_CONFIG -DDM_X -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11
# else
/* Sun with site-provided MIT X11. */
@@ -697,8 +700,8 @@ set -S2 "/bin/sh"
# define MGED_CONFIG -DUSE_MESA_GL -DDM_X -DDM_OGL -I''XINCDIR
# define MGED_OBJS dm-X dm-ogl dm-generic
$# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../.libMesa.sun4 -lMesaGL
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11 -lGL
# else
# define LIBDM_OBJS dm-X
@@ -707,8 +710,8 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define MGED_CONFIG -DDM_X -I''XINCDIR
# define MGED_OBJS dm-X dm-generic
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11
# endif
@@ -738,9 +741,9 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# if defined( __GNUC__ )
# define CC gcc
# if 1 /* PRODUCTION=1 */
# define OPTIMIZER -O2 -fwritable-strings -Wall
# define OPTIMIZER -O2 -fwritable-strings
# else
# define OPTIMIZER -g -fwritable-strings -Wall
# define OPTIMIZER -g -fwritable-strings
# endif
# define CC_DEFS -D_REENTRANT -DSUNOS=55
# define CC_OPTS -I''XINCDIR
@@ -793,8 +796,8 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
#else
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -lnsl -lsocket
#endif
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11
# else
/* Compiling XGL requires SDK (Solaris Developer's Kit) */
@@ -901,7 +904,7 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define BSD 44
# define HAS_TCP 1
# define HAS_SYMLINKS 1
# if 0 /* PRODUCTION=1 */
# if 1 /* PRODUCTION=1 */
# define OPTIMIZER -O2
# else
# define OPTIMIZER -g
@@ -909,7 +912,7 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# if 1 /* PRODUCTION=1 */
/* Shared library version support. Requires ELF for Linux. */
# define CC gcc
# define CC_OPTS -fPIC -Wall
# define CC_OPTS -fPIC
# define ARCH_SUF so
# define LIBVERS ../sh/sharedlibvers.sh
# define BUILD_LIBRARY gcc -shared -o
@@ -920,7 +923,7 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define CC gcc
# define RANLIB ar -s
/* Don't use -ansi, that gives __STRICT_ANSI__. Default is _GNU_SOURCE. */
# define CC_OPTS -Wall
# define CC_OPTS /**/
# endif
# define XINCDIR /usr/X11R6/include
# define XLIBDIR /usr/X11R6/lib
@@ -946,6 +949,7 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# endif
# define MGED_OBJS dm-ogl dm-X dm-generic
# define MGED_CONFIG -DUSE_MESA_GL -DDM_X -DDM_OGL -I''XINCDIR
# define LIBTCLHOOKS_LIBES -L/usr/X11R6/lib -lGL
# else /* just use X */
# define LIBFB_CONFIG -DIF_REMOTE -DIF_AB -I''XINCDIR -DIF_X
# define LIBFB_LIBES LIBPKG -L''XLIBDIR -lX11
@@ -957,8 +961,8 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define MGED_CONFIG -DDM_X -I''XINCDIR
# endif
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lX11
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" -ldl \$"(XLIBDIR)" -lXi -lXext -lX11
# if 0 /* Use the system-provided TCL and Tk libraries */
# define LIBTCL_DIR _use_system_tcl_
@@ -987,22 +991,19 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define XINCDIR /usr/X11R6/include
# define XLIBDIR /usr/X11R6/lib
# define CC gcc
# define OPTIMIZER -O2
# define LEX_OPTS -l
# if 1 /* PRODUCTION=1 */
# define OPTIMIZER -O2
# else
# define OPTIMIZER -g
# endif
# if 1 /* PRODUCTION=1 */
/* Shared library version support. */
# define CC_DEFS -pipe -fPIC -Wall
# define CC_DEFS -pipe -fPIC
# define ARCH_SUF so
# define LIBVERS ../sh/sharedlibvers.sh
# define BUILD_LIBRARY ld -Bshareable -o
# define STANDARD_LIBES -lm -Wl,-R -Wl,LIBDIR
# else
/* Static linked executables */
# define CC_DEFS -pipe -Wall
# define CC_DEFS -pipe
# endif
# define LIBRT_TIMER timer42
@@ -1015,20 +1016,9 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define MGED_OBJS dm-X dm-generic
# define MGED_CONFIG -DDM_X -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES LIBFB LIBFB_LIBES -lXi -lXext
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11
/* Use the system-provided TCL and Tk libraries */
/* XXX What about the system-provided itcl library? */
# if 0 /* PRODUCTION=1 */
# define LIBTCL_DIR _use_system_tcl_
# define LIBTCL_USE_SYSTEM
# define LIBTCL -L/usr/local/lib -ltcl82
# define LIBTCL_DEP /**/
# define LIBTK_DIR _use_system_tk_
# define LIBTK -L/usr/local/lib -ltk82
# define LIBTK_DEP /**/
# endif
/* Use the system-provided libz and libpng */
# define LIBZ_DIR _use_system_z_
# define LIBZ -lz
@@ -1061,8 +1051,8 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define MGED_OBJS dm-X dm-generic
# define MGED_CONFIG -DDM_X -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lX11 -lipc
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" -ldl \$"(XLIBDIR)" -lXi -lXext -lX11
#endif
@@ -1094,8 +1084,8 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define MGED_OBJS dm-X dm-generic
# define MGED_CONFIG -DDM_X -I''XINCDIR
# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lX11
# define CWISH_LIBES MGED_LIBES
# define CWISH_CONFIG -I''XINCDIR
# define BWISH_LIBES MGED_LIBES
# define BWISH_CONFIG -I''XINCDIR
# define LIBDM_SAMPLE_LIBES \$"(LIBDM)" \$"(LIBTK)" \$"(LIBTCL)" \$"(LIBTK_LIBES)" \$"(LIBTCL_LIBES)" \$"(XLIBDIR)" -lXi -lXext -lX11
#endif
@@ -1917,6 +1907,10 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define LIBPKG_LIBES /**/
#endif
#ifndef LIBTCLHOOKS_CONFIG
# define LIBTCLHOOKS_CONFIG /**/
#endif
#ifndef MGED_CONFIG
# define MGED_CONFIG /**/
#endif
@@ -1929,12 +1923,12 @@ $# define MGED_LIBES LIBDM LIBDM_LIBES -L''XLIBDIR -lXi -lXext -lX11 -ly -L../
# define MGED_LIBES /**/
#endif
#ifndef CWISH_CONFIG
# define CWISH_CONFIG /**/
#ifndef BWISH_CONFIG
# define BWISH_CONFIG /**/
#endif
#ifndef CWISH_LIBES
# define CWISH_LIBES /**/
#ifndef BWISH_LIBES
# define BWISH_LIBES /**/
#endif
#ifndef LIBVERS
+2 -2
View File
@@ -25,7 +25,7 @@ anim_cascade: anim_cascade.o LIBBN_DEP LIBBU_DEP
CC LDFLAGS anim_cascade.o LIBRT LIBBN LIBBU LIBBU_LIBES LIBES -o anim_cascade
anim_fly: anim_fly.o LIBBU_DEP
CC LDFLAGS anim_fly.o LIBES LIBBU LIBBU_LIBES -o anim_fly
CC LDFLAGS anim_fly.o LIBBU LIBBU_LIBES LIBES -o anim_fly
anim_hardtrack: anim_hardtrack.o LIBBN_DEP LIBBU_DEP
CC LDFLAGS anim_hardtrack.o LIBRT LIBBN LIBBU LIBBU_LIBES LIBES -o anim_hardtrack
@@ -46,7 +46,7 @@ anim_script: anim_script.o LIBBN_DEP LIBBU_DEP
CC LDFLAGS anim_script.o LIBRT LIBBN LIBBU LIBBU_LIBES LIBES -o anim_script
anim_sort: anim_sort.o LIBBU_DEP
CC LDFLAGS anim_sort.o LIBES LIBBU LIBBU_LIBES -o anim_sort
CC LDFLAGS anim_sort.o LIBBU LIBBU_LIBES LIBES -o anim_sort
anim_time: anim_time.o
CC LDFLAGS anim_time.o LIBRT LIBBN LIBBU LIBBU_LIBES LIBES -o anim_time
+1 -2
View File
@@ -23,7 +23,7 @@
* All rights reserved.
*/
#ifndef lint
static const char RCSid[] = "@(#)$Header$ (BRL)";
static char RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -36,7 +36,6 @@ long offmany;
char usage[] = "Usage: pixcmp f1.pix f2.pix\n";
int
main(argc, argv)
char **argv;
{
+33
View File
@@ -0,0 +1,33 @@
/*
* bwish/Cakefile
*
*/
#define CONFIGDEFS BWISH_CONFIG
#define SRCDIR bwish
#define PRODUCTS bwish
#if 0
#define STATIC_PRODUCTS bwish.tcl
#endif
#define SRCSUFF .c
#define MANSECTION 1
#define FILES bwish input tcl cmd
#include "../Cakefile.defs"
#include "../Cakefile.prog"
#if HAS_TCP
# define COMPLETE_LIBES \
LIBFB LIBPKG LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTERMIO BWISH_LIBES LIBES
#else
# define COMPLETE_LIBES \
LIBFB LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTERMIO BWISH_LIBES LIBES
#endif
bwish: OBJ LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBWDB_DEP LIBTCL_DEP LIBTK_DEP LIBDM_DEP LIBFB_DEP
sh ../sh/newvers.sh version "BrlCad Wish (BWISH)"
CC CFLAGS -c vers.c
CC -o bwish LDFLAGS OBJ COMPLETE_LIBES vers.o
#include "../Cakefile.rules"
+4 -4
View File
@@ -1,8 +1,8 @@
/*
* C W I S H . C
* B W I S H . C
*
* This is yet another version of the WISH program for BRL-CAD (maybe it
* should be called YAW :-)). CWISH initializes the Tcl interfaces of the
* should be called YAW :-)). BWISH initializes the Tcl interfaces of the
* BRL-CAD libraries as well as [incr Tcl] and [incr Tk]. This version also
* provides command history and command line editing.
*
@@ -175,7 +175,7 @@ Cad_AppInit(interp)
(void)Tcl_Eval(interp, bu_vls_addr(&vls));
bu_vls_free(&vls);
/* register cwish commands */
/* register bwish commands */
cmdInit(interp);
/*
@@ -185,6 +185,6 @@ Cad_AppInit(interp)
* then no user-specific startup file will be run under any conditions.
*/
Tcl_SetVar(interp, "tcl_rcFileName", "~/.cwishrc", TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_rcFileName", "~/.bwishrc", TCL_GLOBAL_ONLY);
return TCL_OK;
}
+6 -6
View File
@@ -1,7 +1,7 @@
/*
* C M D . C
*
* This is the place where CWISH's commands live.
* This is the place where BWISH's commands live.
* The history routines were borrowed from mged/history.c
* and modified for use in this application.
*
@@ -45,7 +45,7 @@ void quit();
HIDDEN struct bu_cmdhist histHead;
HIDDEN struct bu_cmdhist *currHist;
HIDDEN struct bu_cmdtab cwish_cmds[] =
HIDDEN struct bu_cmdtab bwish_cmds[] =
{
"exit", cmd_quit,
"history", cmd_history,
@@ -58,15 +58,15 @@ int
cmdInit(interp)
Tcl_Interp *interp;
{
/* Register cwish commands */
bu_register_cmds(interp, cwish_cmds);
/* Register bwish commands */
bu_register_cmds(interp, bwish_cmds);
/* initialize command history */
historyInit();
return TCL_OK;
}
/***************************** CWISH COMMANDS *****************************/
/***************************** BWISH COMMANDS *****************************/
HIDDEN int
cmd_quit(clientData, interp, argc, argv)
@@ -91,7 +91,7 @@ quit(status)
Tcl_Exit(status);
}
/***************************** CWISH COMMAND HISTORY *****************************/
/***************************** BWISH COMMAND HISTORY *****************************/
HIDDEN void
historyInit()
+5 -2
View File
@@ -32,8 +32,11 @@
*
*/
#include <sys/time.h>
#include <time.h>
#if defined(IRIX) && IRIX == 5
#define _BSD_COMPAT
#endif
#include <sys/time.h>
#include "conf.h"
#include "tcl.h"
@@ -56,7 +59,7 @@
#define ESC 27
#define BACKSPACE '\b'
#define DELETE 127
#define PROMPT "\rcwish> "
#define PROMPT "\rbwish> "
#define SPACES " "
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* T C L . C
*
* The supporting Tcl routines for CWISH.
* The supporting Tcl routines for BWISH.
*
* Author -
* Robert G. Parker
@@ -33,7 +33,7 @@
#include "externs.h"
#include "bu.h"
#define CWISH_RCFILENAME ".cwishrc"
#define BWISH_RCFILENAME ".bwishrc"
/*
* Main program for wish-like applications that desire command
@@ -114,7 +114,7 @@ Cad_Main(argc, argv, appInitProc, interp)
initInput();
/* Set the name of the startup file. */
Tcl_SetVar(interp, "tcl_rcFileName", CWISH_RCFILENAME, TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_rcFileName", BWISH_RCFILENAME, TCL_GLOBAL_ONLY);
/* Source the startup file if it exists. */
Tcl_SourceRCFile(interp);
+3 -4
View File
@@ -9,7 +9,7 @@
g-euclid euclid_format euclid_unformat tankill-g g-tankill \
viewpoint-g dxf-g g-nmg g-euclid1 fast4-g proe-g \
asc-nmg nmg-rib g-vrml g-acad cy-g nastran-g g-wave \
nmg-polysolid g-shell.rect stl-g g4-g5
nmg-polysolid g-shell.rect stl-g poly-bot
#define SRCSUFF .c
#define MANSECTION 1
@@ -19,6 +19,8 @@
#include "../Cakefile.prog"
/* Explicit composition of each product */
poly-bot: poly-bot.o LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBWDB_DEP LIBTCL_DEP
CC LDFLAGS poly-bot.o LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTCL LIBTCL_LIBES LIBES -o poly-bot
nmg-polysolid: nmg-polysolid.o LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBTCL_DEP LIBWDB_DEP
CC LDFLAGS nmg-polysolid.o LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTCL LIBTCL_LIBES LIBES -o nmg-polysolid
@@ -108,7 +110,4 @@ nmg-rib: nmg-rib.o LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBTCL_DEP
g-vrml: g-vrml.o LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBTCL_DEP
CC LDFLAGS g-vrml.o LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTCL LIBTCL_LIBES LIBES -o g-vrml
g4-g5: g4-g5.o LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBTCL_DEP
CC LDFLAGS g4-g5.o LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTCL LIBTCL_LIBES LIBES -o g4-g5
#include "../Cakefile.rules"
+51 -2
View File
@@ -3425,8 +3425,9 @@ struct db_i *dbip;
case OP_DB_LEAF:
if( (dp=db_lookup( dbip, ptr->tr_l.tl_name, LOOKUP_QUIET)) == DIR_NULL )
{
ptr->tr_l.tl_op = OP_NOP;
return( ptr );
db_free_tree( ptr );
ptr = TREE_NULL;
return( TREE_NULL );
}
if( !(dp->d_flags & DIR_REGION) )
@@ -3512,6 +3513,54 @@ struct db_i *dbip;
/* recurse */
ptr->tr_b.tb_left = expand_tree( ptr->tr_b.tb_left, dbip );
ptr->tr_b.tb_right = expand_tree( ptr->tr_b.tb_right, dbip );
if( (ptr->tr_b.tb_left == TREE_NULL) && (ptr->tr_b.tb_right == TREE_NULL) )
{
ptr->tr_op = 0;
bu_free( (char *)ptr, "union tree" );
ptr = TREE_NULL;
}
else if( ptr->tr_b.tb_right == TREE_NULL )
{
if( ptr->tr_op == OP_INTERSECT )
{
/* intersection with nothing is nothing */
db_free_tree( ptr->tr_b.tb_left );
ptr->tr_op = 0;
bu_free( (char *)ptr, "union tree" );
ptr = TREE_NULL;
}
else
{
union tree *save;
/* just return the left tree */
save = ptr->tr_b.tb_left;
ptr->tr_op = 0;
bu_free( (char *)ptr, "union tree" );
ptr = save;
}
}
else if( ptr->tr_b.tb_left == TREE_NULL )
{
if( ptr->tr_op == OP_UNION )
{
union tree *save;
/* return the right tree */
save = ptr->tr_b.tb_right;
ptr->tr_op = 0;
bu_free( (char *)ptr, "union tree" );
ptr = save;
}
else
{
/* result is nothing */
db_free_tree( ptr->tr_b.tb_right );
ptr->tr_op = 0;
bu_free( (char *)ptr, "union tree" );
ptr = TREE_NULL;
}
}
return( ptr );
break;
}
+3 -2
View File
@@ -175,10 +175,11 @@ genptr_t client_data;
}
static union tree *
leaf_stub( tsp, pathp, ip, client_data )
leaf_stub( tsp, pathp, ep, id, client_data )
struct db_tree_state *tsp;
struct db_full_path *pathp;
struct rt_db_internal *ip;
struct bu_external *ep;
int id;
genptr_t client_data;
{
bu_log( "leaf stub called, this shouldn't happen\n" );
+3 -2
View File
@@ -147,10 +147,11 @@ genptr_t client_data;
}
static union tree *
leaf_stub( tsp, pathp, ip, client_data )
leaf_stub( tsp, pathp, ep, id, client_data )
struct db_tree_state *tsp;
struct db_full_path *pathp;
struct rt_db_internal *ip;
struct bu_external *ep;
int id;
genptr_t client_data;
{
struct directory *fp_name; /* name from pathp */
+5 -1
View File
@@ -4,7 +4,7 @@ g-vrml \- Perform Boolean evaluations to produce a VRML version 2.0 file
.SH SYNOPSIS
.B g-vrml
[-v] [-d calc_dist_tol] [-a abs_tess_tol] [-n norm_tess_tol] [-r rel_tess_tol]
[-x librt_debug_flag] [-X NMG_debug_flag] [-o outfile] infile.g object(s)
[-x librt_debug_flag] [-X NMG_debug_flag] [-u units_name] [-o outfile] infile.g object(s)
.SH DESCRIPTION
.I g-vrml
performs the Boolean operations specified in any regions in the specified
@@ -52,6 +52,10 @@ routines respectively. The definitions of these flags may be found in
.I librt/debug.h
and
.I h/nmg.h.
The
.I -u
option can be used to set the units for the resulting VRML file (the default is mm).
Any units name that MGED accepts will work here.
.SH EXAMPLE
.RS
$ \|\fIg-vrml \|-o shell.wrl \|sample.g \|sample_object\fP
+188 -11
View File
@@ -24,7 +24,7 @@
*/
#ifndef lint
static char RCSid[] = "$Header$";
static const char RCSid[] = "$Header$";
#endif
#include "conf.h"
@@ -89,8 +89,9 @@ struct bu_structparse vrml_mat_parse[]={
};
BU_EXTERN(union tree *do_region_end, (struct db_tree_state *tsp, struct db_full_path *pathp, union tree *curtree, genptr_t client_data));
BU_EXTERN(union tree *nmg_region_end, (struct db_tree_state *tsp, struct db_full_path *pathp, union tree *curtree, genptr_t client_data));
static char usage[] = "Usage: %s [-v] [-xX lvl] [-d tolerance_distance (mm) ] [-a abs_tol (mm)] [-r rel_tol] [-n norm_tol] [-o out_file] brlcad_db.g object(s)\n";
static char usage[] = "Usage: %s [-v] [-xX lvl] [-d tolerance_distance (mm) ] [-a abs_tol (mm)] [-r rel_tol] [-n norm_tol] [-o out_file] [-u units] brlcad_db.g object(s)\n";
static char *tok_sep = " \t";
static int NMG_debug; /* saved arg of -X, for longjmp handling */
@@ -103,6 +104,9 @@ static struct rt_tess_tol ttol;
static struct bn_tol tol;
static struct model *the_model;
static char* units=NULL;
static fastf_t scale_factor=1.0;
static struct db_tree_state tree_state; /* includes tol & model */
static int regions_tried = 0;
@@ -165,6 +169,42 @@ genptr_t client_data;
return( !select_lights( tsp, pathp, combp, client_data ) );
}
union tree *
leaf_tess(tsp, pathp, ep, id, client_data)
struct db_tree_state *tsp;
struct db_full_path *pathp;
struct bu_external *ep;
int id;
genptr_t client_data;
{
struct rt_db_internal intern;
struct rt_bot_internal *bot;
struct directory *dp;
if( id != ID_BOT )
return( nmg_booltree_leaf_tess(tsp, pathp, ep, id, client_data) );
RT_INIT_DB_INTERNAL(&intern);
if (rt_functab[id].ft_import(&intern, ep, tsp->ts_mat, tsp->ts_dbip) < 0) {
bu_log("nmg_booltree_leaf_tess(%s): solid import failure\n", dp->d_namep);
if (intern.idb_ptr) rt_functab[id].ft_ifree(&intern);
return(TREE_NULL); /* ERROR */
}
RT_CK_DB_INTERNAL(&intern);
bot = (struct rt_bot_internal *)intern.idb_ptr;
RT_BOT_CK_MAGIC( bot );
if( bot->mode == RT_BOT_PLATE || bot->mode == RT_BOT_SURFACE )
{
rt_db_free_internal( &intern );
return( (union tree *)NULL );
}
rt_db_free_internal( &intern );
return( nmg_booltree_leaf_tess(tsp, pathp, ep, id, client_data) );
}
/*
* M A I N
*/
@@ -210,7 +250,7 @@ char *argv[];
BU_LIST_INIT( &rt_g.rtg_vlfree ); /* for vlist macros */
/* Get command line arguments. */
while ((c = getopt(argc, argv, "d:a:n:o:r:vx:P:X:")) != EOF) {
while ((c = getopt(argc, argv, "d:a:n:o:r:vx:P:X:u:")) != EOF) {
switch (c) {
case 'a': /* Absolute tolerance. */
ttol.abs = atof(optarg);
@@ -244,6 +284,16 @@ char *argv[];
sscanf( optarg, "%x", &rt_g.NMG_debug );
NMG_debug = rt_g.NMG_debug;
break;
case 'u':
units = bu_strdup( optarg );
scale_factor = bu_units_conversion( units );
if( scale_factor == 0.0 )
{
bu_log( "Unrecognized units (%s)\n", units );
bu_bomb( "Unrecognized units\n" );
}
scale_factor = 1.0 / scale_factor;
break;
default:
fprintf(stderr, usage, argv[0]);
exit(1);
@@ -256,6 +306,9 @@ char *argv[];
exit(1);
}
if( !units )
units = "mm";
/* Open brl-cad database */
if ((dbip = db_open( argv[optind] , "r")) == DBI_NULL)
{
@@ -278,7 +331,7 @@ char *argv[];
}
fprintf( fp_out, "#VRML V2.0 utf8\n" );
fprintf( fp_out, "#Original Database Units were %s, VRML units are meters\n",rt_units_string(dbip->dbi_local2base));
fprintf( fp_out, "#Units are %s\n", units);
/* Note we may want to inquire about bounding boxes for the various groups and add Viewpoints nodes that
* point the camera to the center and orient for Top, Side, etc Views
*
@@ -320,7 +373,7 @@ char *argv[];
&tree_state,
select_lights,
do_region_end,
nmg_booltree_leaf_tess,
leaf_tess,
(genptr_t)NULL); /* in librt/nmg_bool.c */
@@ -339,13 +392,12 @@ char *argv[];
&tree_state,
select_non_lights,
do_region_end,
nmg_booltree_leaf_tess,
leaf_tess,
(genptr_t)NULL); /* in librt/nmg_bool.c */
/* Release dynamic storage */
nmg_km(the_model);
bn_vlist_cleanup();
db_close(dbip);
/* Now we need to close each group set */
@@ -653,8 +705,8 @@ struct mater_info *mater;
vg = v->vg_p;
NMG_CK_VERTEX_G( vg );
/* convert to meters */
VSCALE( pt_meters, vg->coord, 0.001 );
/* convert to desired units */
VSCALE( pt_meters, vg->coord, scale_factor );
if( is_light )
VADD2( ave_pt, ave_pt, pt_meters )
@@ -758,6 +810,91 @@ struct mater_info *mater;
}
}
void
is_leaf_bot( dbip, dp, clientdata )
struct db_i *dbip;
struct directory *dp;
genptr_t clientdata;
{
struct rt_bot_internal *bot, **abot;
struct rt_db_internal intern;
int id;
id = rt_db_get_internal( &intern, dp, dbip, bn_mat_identity );
if( id < 0 )
{
bu_log( "Error importing solid (%s)\n", dp->d_namep );
bu_bomb( "Error importing solid\n" );
}
if( id == ID_BOT )
{
int *i;
i = (int *)clientdata;
(*i)++;
}
else
rt_db_free_internal( &intern );
}
void
bot2vrml( dbip, comb, tree, ptr1, ptr2, ptr3 )
struct db_i *dbip;
struct rt_comb_internal *comb;
union tree *tree;
genptr_t ptr1, ptr2, ptr3;
{
struct db_full_path *pathp;
char *path_str;
int appearance;
struct directory *dp;
struct rt_db_internal intern;
struct rt_bot_internal *bot;
int id;
int i;
if( (dp = db_lookup( dbip, tree->tr_l.tl_name, 1 )) == DIR_NULL )
bu_bomb( "db_lookup failed!!\n" );
id = rt_db_get_internal( &intern, dp, dbip, tree->tr_l.tl_mat );
if( id != ID_BOT )
{
bu_log( "ERROR: %s is not a BOT solid!!!!\n", tree->tr_l.tl_name );
bu_bomb( "ERROR: expecting a BOT solid!!!!\n" );
}
bot = (struct rt_bot_internal *)intern.idb_ptr;
RT_BOT_CK_MAGIC( bot );
pathp = (struct db_full_path *)ptr1;
path_str = db_path_to_string( pathp );
fprintf( fp_out, "\t\tShape {\n\t\t\t# Component_ID: %d %s\n", comb->region_id, path_str );
bu_free( path_str, "result of db_path_to_string" );
appearance = comb->region_id / 1000;
appearance = appearance * 1000 + 999;
fprintf( fp_out, "\t\t\tappearance Appearance {\n\t\t\tmaterial USE Material_%d\n\t\t\t}\n", appearance );
fprintf( fp_out, "\t\t\tgeometry IndexedFaceSet {\n\t\t\t\tcoord Coordinate {\n\t\t\t\tpoint [\n" );
for( i=0 ; i<bot->num_vertices ; i++ )
{
point_t pt;
VSCALE( pt, &bot->vertices[i*3], scale_factor );
fprintf( fp_out, "\t\t\t\t\t%10.10e %10.10e %10.10e, # point %d\n", V3ARGS( pt ), i );
}
fprintf( fp_out, "\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t\tcoordIndex [\n" );
for( i=0 ; i<bot->num_faces ; i++ )
fprintf( fp_out, "\t\t\t\t\t%d, %d, %d, -1,\n", V3ARGS( &bot->faces[i*3] ) );
fprintf( fp_out, "\t\t\t\t]\n\t\t\t\tnormalPerVertex FALSE\n" );
fprintf( fp_out, "\t\t\t\tconvex TRUE\n" );
fprintf( fp_out, "\t\t\t\tcreaseAngle 0.5\n" );
fprintf( fp_out, "\t\t\t\tsolid FALSE\n" );
fprintf( fp_out, "\t\t\t}\n\t\t}\n" );
}
/*
* D O _ R E G I O N _ E N D
*
@@ -771,10 +908,48 @@ struct db_full_path *pathp;
union tree *curtree;
genptr_t client_data;
{
extern FILE *fp_fig;
struct directory *dp;
struct rt_comb_internal *comb;
struct rt_db_internal intern;
int id;
int bot=0;
char *name;
if( tsp->ts_is_fastgen != REGION_FASTGEN_PLATE )
return( nmg_region_end(tsp, pathp, curtree, client_data) );
/* FASTGEN plate mode region, just spew the bot triangles */
dp = DB_FULL_PATH_CUR_DIR(pathp);
db_functree( tsp->ts_dbip, dp, NULL, is_leaf_bot, (genptr_t)&bot );
if( !bot )
return( nmg_region_end(tsp, pathp, curtree, client_data) );
else
{
id = rt_db_get_internal( &intern, dp, dbip, bn_mat_identity );
if( id != ID_COMBINATION )
{
bu_log( "ERROR: %s is not a combination????\n", dp->d_namep );
bu_bomb( "Expected a region!!!!\n" );
}
comb = (struct rt_comb_internal *)intern.idb_ptr;
name = db_path_to_string( pathp );
bu_log( "Attempting %s\n", name );
bu_free( name, "db_path_to_string" );
db_tree_funcleaf( tsp->ts_dbip, comb, comb->tree, bot2vrml, pathp, NULL, NULL );
return( (union tree *)NULL );
}
}
union tree *nmg_region_end(tsp, pathp, curtree, client_data)
register struct db_tree_state *tsp;
struct db_full_path *pathp;
union tree *curtree;
genptr_t client_data;
{
struct nmgregion *r;
struct bu_list vhead;
union tree *ret_tree;
char *name;
RT_CK_TESS_TOL(tsp->ts_ttol);
BN_CK_TOL(tsp->ts_tol);
@@ -794,7 +969,9 @@ genptr_t client_data;
if (curtree->tr_op == OP_NOP)
return curtree;
bu_log( "Attempting %s\n", db_path_to_string( pathp ) );
name = db_path_to_string( pathp );
bu_log( "Attempting %s\n", name );
bu_free( name, "db_path_to_string" );
regions_tried++;
/* Begin rt_bomb() protection */
+2 -1
View File
@@ -636,8 +636,9 @@ combdump() /* Print out Combination record information */
case DBV4_REGION:
(void)fprintf(ofp, "Y "); /* Y if `R' */
break;
case DBV4_NON_REGION_NULL:
case DBV4_NON_REGION:
(void)fprintf(ofp, "N "); /* N if ` ' */
(void)fprintf(ofp, "N "); /* N if ` ' or '\0' */
break;
case DBV4_REGION_FASTGEN_PLATE:
(void)fprintf(ofp, "P ");
-109
View File
@@ -1,109 +0,0 @@
#include "conf.h"
#include <stdio.h>
#include "machine.h"
#include "bu.h"
#include "vmath.h"
#include "bn.h"
#include "raytrace.h"
#include "rtgeom.h"
int
main(argc, argv)
int argc;
char **argv;
{
FILE *fp;
struct db_i *dbip;
struct directory *dp;
int i;
long errors = 0;
struct bn_tol tol;
/* XXX These need to be improved */
tol.magic = BN_TOL_MAGIC;
tol.dist = 0.005;
tol.dist_sq = tol.dist * tol.dist;
tol.perp = 1e-6;
tol.para = 1 - tol.perp;
bu_debug = BU_DEBUG_COREDUMP;
if( argc != 3 ) {
fprintf(stderr, "Usage: %s v4.g v5.g\n", argv[0]);
return 1;
}
if( (dbip = db_open( argv[1], "r" )) == DBI_NULL ) {
perror( argv[1] );
return 2;
}
if( (fp = fopen( argv[2], "w" )) == NULL ) {
perror( argv[2] );
return 3;
}
RT_CK_DBI(dbip);
db_dirbuild( dbip );
db5_fwrite_ident( fp, dbip->dbi_title, dbip->dbi_local2base );
/* Retrieve every item in the input database */
for( i = RT_DBNHASH-1; i >= 0; i-- ) {
for( dp = dbip->dbi_Head[i]; dp; dp = dp->d_forw ) {
struct rt_db_internal intern;
int id;
int ret;
fprintf(stderr, "%s\n", dp->d_namep );
id = rt_db_get_internal( &intern, dp, dbip, NULL );
if( id < 0 ) {
fprintf(stderr,
"%s: rt_db_get_internal(%s) failure, skipping\n",
argv[0], dp->d_namep);
errors++;
continue;
}
if ( id == ID_HF ) {
if (rt_hf_to_dsp( &intern )) {
fprintf(stderr,
"%s: Conversion from HF to DSP failed for solid %s\n",
argv[0], dp->d_namep );
errors++;
continue;
}
}
if( id == ID_POLY)
{
if( rt_pg_to_bot( &intern, &tol ) )
{
fprintf( stderr, "%s: Conversion from polysolid to BOT failed for solid %s\n",
argv[0], dp->d_namep );
errors++;
continue;
}
}
ret = rt_fwrite_internal5( fp, dp->d_namep, &intern, 1.0, NULL );
if( ret < 0 ) {
fprintf(stderr,
"%s: rt_fwrite_internal5(%s) failure, skipping\n",
argv[0], dp->d_namep);
rt_db_free_internal( &intern );
errors++;
continue;
}
rt_db_free_internal( &intern );
}
}
fclose( fp );
db_close( dbip );
fprintf(stderr, "%ld objects failed to convert\n", errors);
return 0;
}
+222
View File
@@ -0,0 +1,222 @@
/*
* P O L Y - B O T
*
* Program to convert all the polysolids in a BRL-CAD model (in a .g file) to BOT solids
*
* Author -
* John R. Anderson
*
* Source -
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5066
*
* Distribution Notice -
* Re-distribution of this software is restricted, as described in
* your "Statement of Terms and Conditions for the Release of
* The BRL-CAD Pacakge" agreement.
*
* Copyright Notice -
* This software is Copyright (C) 2000 by the United States Army
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static char RCSid[] = "$Header$";
#endif
#include "conf.h"
#include <stdio.h>
#include <math.h>
#ifdef USE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "externs.h"
#include "vmath.h"
#include "nmg.h"
#include "db.h"
#include "rtgeom.h"
#include "raytrace.h"
#include "wdb.h"
#include "../librt/plane.h"
#include "../librt/debug.h"
#define POLY_BLOCK 512
static char *usage="\
Usage: poly-bot < file_poly.g > file_bot.g\n\
or poly-bot file_poly.g file_bot.g\n\
Convert polysolids to BOT solids\n";
main( argc, argv )
int argc;
char *argv[];
{
FILE *ifp;
FILE *ofp;
union record record;
union record *poly;
long poly_limit=0;
long curr_poly=0;
struct rt_tess_tol ttol;
struct bn_tol tol;
int polys=0;
int frees=0;
int others=0;
ifp = stdin;
ofp = stdout;
ttol.magic = RT_TESS_TOL_MAGIC;
/* Defaults, updated by command line options. */
ttol.abs = 0.0;
ttol.rel = 0.01;
ttol.norm = 0.0;
/* XXX These need to be improved */
tol.magic = BN_TOL_MAGIC;
tol.dist = 0.005;
tol.dist_sq = tol.dist * tol.dist;
tol.perp = 1e-6;
tol.para = 1 - tol.perp;
if( argc >= 3 ) {
ifp = fopen(argv[1],"r");
if( !ifp ) perror(argv[1]);
ofp = fopen(argv[2],"w");
if( !ofp ) perror(argv[2]);
if (ifp == NULL || ofp == NULL) {
(void)fprintf(stderr, "g2asc: can't open files.");
exit(1);
}
}
if (isatty(fileno(ifp))) {
(void)fprintf(stderr, usage);
exit(1);
}
poly = (union record *)bu_malloc( POLY_BLOCK * sizeof( union record ), "poly" );
poly_limit = POLY_BLOCK;
/* Read database file */
while( fread( (char *)&record, sizeof record, 1, ifp ) == 1 && !feof(ifp) )
{
top:
switch( record.u_id )
{
case ID_FREE:
frees++;
continue;
case ID_P_HEAD:
{
struct rt_db_internal intern;
struct bu_external ext;
struct rt_bot_internal *bot;
struct soltab st;
struct rt_i rti;
struct tri_specific *tri;
int i;
rti.rti_tol = tol;
polys++;
curr_poly = 0;
poly[curr_poly++] = record; /* struct copy */
bu_log( "Converting %s\n", poly[0].p.p_name );
while( fread( (char *)&record, sizeof record, 1, ifp ) == 1 &&
!feof(ifp) &&
record.u_id == ID_P_DATA )
{
if( curr_poly >= poly_limit )
{
poly_limit += POLY_BLOCK;
poly = (union record *)bu_realloc( poly, poly_limit*sizeof( union record ), "poly realloc" );
}
poly[curr_poly++] = record; /* struct copy */
}
BU_INIT_EXTERNAL( &ext );
ext.ext_nbytes = curr_poly * sizeof( union record );
ext.ext_buf = (char *)poly;
if( rt_pg_import( &intern, &ext, bn_mat_identity, (struct db_i *)NULL ) )
{
bu_log( "Import failed for polysolid %s\n", poly[0].p.p_name );
bu_bomb( "Import failed for polysolid\n" );
}
st.st_specific = (genptr_t)NULL;
if( rt_pg_prep( &st, &intern, &rti ) )
{
bu_log( "Unable to convert polysolid %s\n", poly[0].p.p_name );
bu_bomb( "Unable to convert!!!\n" );
}
tri = (struct tri_specific *)st.st_specific;
bot = (struct rt_bot_internal *)bu_calloc( 1, sizeof( struct rt_bot_internal), "bot" );
bot->magic = RT_BOT_INTERNAL_MAGIC;
bot->mode = RT_BOT_SOLID;
bot->orientation = RT_BOT_CCW;
bot->num_vertices = 0;
bot->num_faces = 0;
while( tri )
{
bot->num_faces++;
tri = tri->tri_forw;
}
bot->faces = (int *)bu_calloc( bot->num_faces * 3, sizeof( int ), "bot->faces" );
bot->num_vertices = bot->num_faces * 3;
bot->vertices = (fastf_t *)bu_calloc( bot->num_vertices * 3, sizeof( fastf_t ), "bot->vertices" );
i = 0;
tri = (struct tri_specific *)st.st_specific;
while( tri )
{
bot->faces[i] = i;
bot->faces[i + 1] = i + 1;
bot->faces[i + 2] = i + 2;
VMOVE( &bot->vertices[i*3], tri->tri_A );
VADD2( &bot->vertices[(i+1)*3], tri->tri_A, tri->tri_BA );
VADD2( &bot->vertices[(i+2)*3], tri->tri_A, tri->tri_CA );
tri = tri->tri_forw;
i += 3;
}
(void)bot_vertex_fuse( bot );
mk_export_fwrite( ofp, poly[0].p.p_name, (genptr_t)bot, ID_BOT );
tri = (struct tri_specific *)st.st_specific;
while( tri )
{
struct tri_specific *tmp;
tmp = tri;
tri = tri->tri_forw;
bu_free( (char *)tmp, "tri_specific" );
}
bu_free( (char *)bot->faces, "bot->faces" );
bu_free( (char *)bot->vertices, "bot->vertices" );
bu_free( (char *)bot, "bot" );
if( feof( ifp ) )
break;
goto top;
}
case ID_P_DATA:
/* This should not happen!!!! */
bu_log( "ERROR: Unattached polysolid data record!!!!\n" );
continue;
default:
others++;
if( fwrite( &record, sizeof( union record ), 1, ofp ) < 1 )
bu_bomb( "Write failed!!!\n" );
}
}
bu_log( "%d polysolids converted to BOT solids\n", polys );
bu_log( "%d other records copied without change\n", others );
bu_log( "%d free records skipped\n", frees );
}
-33
View File
@@ -1,33 +0,0 @@
/*
* cwish/Cakefile
*
*/
#define CONFIGDEFS CWISH_CONFIG
#define SRCDIR cwish
#define PRODUCTS cwish
#if 0
#define STATIC_PRODUCTS cwish.tcl
#endif
#define SRCSUFF .c
#define MANSECTION 1
#define FILES cwish input tcl cmd
#include "../Cakefile.defs"
#include "../Cakefile.prog"
#if HAS_TCP
# define COMPLETE_LIBES \
LIBFB LIBPKG LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTERMIO CWISH_LIBES LIBES
#else
# define COMPLETE_LIBES \
LIBFB LIBWDB LIBRT LIBBN LIBBU LIBBU_LIBES LIBTERMIO CWISH_LIBES LIBES
#endif
cwish: OBJ LIBRT_DEP LIBBN_DEP LIBBU_DEP LIBWDB_DEP LIBTCL_DEP LIBTK_DEP LIBDM_DEP LIBFB_DEP
sh ../sh/newvers.sh version "Cad Wish (CWISH)"
CC CFLAGS -c vers.c
CC -o cwish LDFLAGS OBJ COMPLETE_LIBES vers.o
#include "../Cakefile.rules"
+44 -37
View File
@@ -8,7 +8,11 @@
* courtesy of inetd. We process a single frame buffer
* open/process/close cycle and then exit. A full installation
* includes setting up inetd and /etc/services to start one
* of these.
* of these, with these entries:
*
* remotefb stream tcp nowait nobody /usr/brlcad/bin/fbserv fbserv
* remotefb 5558/tcp # remote frame buffer
*
* Stand-Alone Daemon - once started we run forever, forking a
* copy of ourselves for each new connection. Each child is
* essentially like above, i.e. one open/process/close cycle.
@@ -16,6 +20,7 @@
* or when inetd is not available.
* A child process is necessary because different framebuffers
* may be specified in each open.
*
* Single-Frame-Buffer Server - we open a particular frame buffer
* at invocation time and leave it open. We will accept
* multiple connections for this frame buffer.
@@ -45,12 +50,17 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static char RCSid[] = "@(#)$Header$ (ARL)";
static const char RCSid[] = "@(#)$Header$ (ARL)";
#endif
#if defined(IRIX) && IRIX==5
#define _BSD_COMPAT
#endif
#include "conf.h"
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <signal.h>
#include <errno.h>
@@ -62,14 +72,20 @@ static char RCSid[] = "@(#)$Header$ (ARL)";
# include <varargs.h>
#endif
#include <sys/time.h> /* For struct timeval */
#if defined(BSD) && !defined(CRAY2)
# include <syslog.h>
#endif
#include <sys/socket.h>
#include <netinet/in.h> /* For htonl(), etc */
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include <sys/wait.h>
#include <sys/time.h> /* For struct timeval */
#include "machine.h"
#include "externs.h" /* For malloc, getopt */
@@ -105,12 +121,8 @@ static int port_set = 0; /* !0 if user supplied port num */
static int once_only = 0;
static int netfd;
struct client {
int fd;
struct pkg_conn *pkg;
};
#define MAX_CLIENTS 32
struct client clients[MAX_CLIENTS];
struct pkg_conn *clients[MAX_CLIENTS];
int verbose = 0;
@@ -124,6 +136,7 @@ Usage: fbserv port_num\n\
(for a single-frame-buffer server)\n\
";
int
get_args( argc, argv )
register char **argv;
{
@@ -177,7 +190,6 @@ register char **argv;
return(1); /* OK */
}
#ifdef BSD
/*
* I S _ S O C K E T
*
@@ -197,7 +209,6 @@ int fd;
else
return 0;
}
#endif /* BSD */
static void
sigalarm(code)
@@ -223,10 +234,9 @@ struct pkg_conn *pcp;
return;
for( i = MAX_CLIENTS-1; i >= 0; i-- ) {
if( clients[i].fd != 0 ) continue;
if( clients == NULL ) continue;
/* Found an available slot */
clients[i].pkg = pcp;
clients[i].fd = pcp->pkc_fd;
clients[i] = pcp;
FD_SET(pcp->pkc_fd, &select_list);
if( pcp->pkc_fd > max_fd ) max_fd = pcp->pkc_fd;
setup_socket( pcp->pkc_fd );
@@ -243,21 +253,20 @@ void
drop_client( sub )
int sub;
{
int fd = clients[sub]->pkc_fd;
if( clients[sub].pkg != PKC_NULL ) {
pkg_close( clients[sub].pkg );
clients[sub].pkg = PKC_NULL;
}
if( clients[sub].fd != 0 ) {
FD_CLR( clients[sub].fd, &select_list );
close( clients[sub].fd );
clients[sub].fd = 0;
}
if( clients[sub] == PKC_NULL ) return;
FD_CLR( fd, &select_list );
pkg_close( clients[sub] );
clients[sub] = PKC_NULL;
(void)close( fd ); /* double-safety */
}
/*
* M A I N
*/
int
main( argc, argv )
int argc; char **argv;
{
@@ -265,7 +274,7 @@ int argc; char **argv;
/* No disk files on remote machine */
_fb_disk_enable = 0;
bzero((void *)clients, sizeof(struct client) * MAX_CLIENTS);
bzero((void *)clients, sizeof(struct pkg_conn *) * MAX_CLIENTS);
(void)signal( SIGPIPE, SIG_IGN );
(void)signal( SIGALRM, sigalarm );
@@ -275,7 +284,6 @@ int argc; char **argv;
fb_server_select_list = &select_list;
fb_server_max_fd = &max_fd;
#ifdef BSD
/*
* Inetd Daemon.
* Check to see if we were invoked by /etc/inetd. If so
@@ -291,7 +299,6 @@ int argc; char **argv;
main_loop();
exit(0);
}
#endif /* BSD */
/* for now, make them set a port_num, for usage message */
if ( !get_args( argc, argv ) || !port_set ) {
@@ -405,7 +412,7 @@ main_loop()
tv.tv_sec = 60L;
tv.tv_usec = 0L;
if( (select( max_fd+1, &infds, (fd_set *)0, (fd_set *)0,
&tv )) == 0 ) {
(void *)&tv )) == 0 ) {
/* Process fb events while waiting for client */
/*printf("select timeout waiting for client\n");*/
if(fb_server_fbp) fb_poll(fb_server_fbp);
@@ -424,12 +431,12 @@ main_loop()
/* Process arrivals from existing clients */
/* First, pull the data out of the kernel buffers */
for( i = MAX_CLIENTS-1; i >= 0; i-- ) {
if( clients[i].fd == 0 ) continue;
if( pkg_process( clients[i].pkg ) < 0 ) {
if( clients[i] == NULL ) continue;
if( pkg_process( clients[i] ) < 0 ) {
fprintf(stderr,"pkg_process error encountered (1)\n");
}
if( ! FD_ISSET( clients[i].fd, &infds ) ) continue;
if( pkg_suckin( clients[i].pkg ) <= 0 ) {
if( ! FD_ISSET( clients[i]->pkc_fd, &infds ) ) continue;
if( pkg_suckin( clients[i] ) <= 0 ) {
/* Probably EOF */
drop_client( i );
ncloses++;
@@ -438,8 +445,8 @@ main_loop()
}
/* Second, process all the finished ones that we just got */
for( i = MAX_CLIENTS-1; i >= 0; i-- ) {
if( clients[i].fd == 0 ) continue;
if( pkg_process( clients[i].pkg ) < 0 ) {
if( clients[i] == NULL ) continue;
if( pkg_process( clients[i] ) < 0 ) {
fprintf(stderr,"pkg_process error encountered (2)\n");
}
}
@@ -547,8 +554,8 @@ fb_log( char *fmt, ... )
want = strlen(outbuf)+1;
for( i = MAX_CLIENTS-1; i >= 0; i-- ) {
if( clients[i].fd == 0 ) continue;
if( pkg_send( MSG_ERROR, outbuf, want, clients[i].pkg ) != want ) {
if( clients[i] == NULL ) continue;
if( pkg_send( MSG_ERROR, outbuf, want, clients[i] ) != want ) {
comm_error("pkg_send error in fb_log, message was:\n");
comm_error(outbuf);
} else {
@@ -665,8 +672,8 @@ va_dcl
want = strlen(outbuf)+1;
for( i = MAX_CLIENTS-1; i >= 0; i-- ) {
if( clients[i].fd == 0 ) continue;
if( pkg_send( MSG_ERROR, outbuf, want, clients[i].pkg ) != want ) {
if( clients[i] == NULL ) continue;
if( pkg_send( MSG_ERROR, outbuf, want, clients[i] ) != want ) {
comm_error("pkg_send error in fb_log, message was:\n");
comm_error(outbuf);
} else {
+36 -15
View File
@@ -37,7 +37,7 @@ NFS=1
# Label number for this CAD Release,
# RCS main Revision number, and date.
#RELEASE=M.N; RCS_REVISION=X; REL=DATE=dd-mmm-yy
RELEASE=5.1; RCS_REVISION=13; REL_DATE=Today # beyond 5.1
RELEASE=5.2; RCS_REVISION=13; REL_DATE=7-Oct-00 # 5.2
#RELEASE=5.0; RCS_REVISION=12; REL_DATE=15-Sept-99 # 5.0 production
#RELEASE=4.6; RCS_REVISION=11; REL_DATE=7-Jul-99 # 5.0beta
#RELEASE=4.5; RCS_REVISION=11; REL_DATE=14-Feb-98 # 4.5 production
@@ -187,6 +187,7 @@ BDIRS="bench \
libmultispectral \
libtermio \
libtclcad \
libtclhooks \
conv \
db \
rt \
@@ -220,8 +221,7 @@ BDIRS="bench \
canon \
burst \
gtools \
tk \
cwish \
bwish \
" # This ends the list.
TSDIRS=". mged nirt pl-dm lib util"
@@ -407,7 +407,8 @@ perms)
#
#########################################
chown -R bin.bin /usr/brlcad
chown -R bin /usr/brlcad
chgrp -R bin /usr/brlcad
for dir in /usr/brlcad/etc /usr/brlcad/html /usr/brlcad/include \
/usr/brlcad/man /usr/brlcad/sample_applications \
@@ -551,6 +552,15 @@ checkin)
# Any additional arguments to "gen.sh" after the "dist" will be passed to "cvs"
#
dist)
# /usr/gnu/bin/tar doesn't work correctly on CAD
# make sure we are not running under IRIX
OS=`uname`
if test "$OS" != Linux -a "$OS" != FreeBSD
then
echo "Source distribution should be made using Linux or FreeBSD"
echo "/usr/gnu/bin/tar is broken under IRIX"
exit
fi
# if this is a tty, get the encryption key
if tty -s
then
@@ -650,58 +660,69 @@ dist)
echo 'pro-engineer/*' >> ${EXCLUDE}
echo 'libtcl/*' >> ${EXCLUDE}
echo 'libtk/*' >> ${EXCLUDE}
echo 'libitcl/*' >> ${EXCLUDE}
/usr/gnu/bin/tar cfv - Copy* README doc html \
tar cfv - Copy* README doc html \
zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-a.gz
chmod 444 ${FTP_ARCHIVE}-a.gz
echo "${FTP_ARCHIVE}-a.gz created (doc)"
/usr/gnu/bin/tar -cvf - -X ${EXCLUDE} [A-Z]* [a-k]* zzzEND |\
tar -cvf - -X ${EXCLUDE} [A-Z]* [a-k]* zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-b.gz
chmod 444 ${FTP_ARCHIVE}-b.gz
echo "${FTP_ARCHIVE}-b.gz created (core 1)"
/usr/gnu/bin/tar -cvf - -X ${EXCLUDE} Copy* README l[a-g]* lia* lib[a-s]* zzzEND |\
tar -cvf - -X ${EXCLUDE} Copy* README l[a-g]* lia* lib[a-s]* zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-c.gz
chmod 444 ${FTP_ARCHIVE}-c.gz
echo "${FTP_ARCHIVE}-c.gz created (core 2)"
/usr/gnu/bin/tar -cvf - -X ${EXCLUDE} Copy* README lib[t-z]* li[c-z]* l[j-z]* [m-t]* zzzEND |\
tar -cvf - -X ${EXCLUDE} Copy* README lib[t-z]* li[c-z]* l[j-z]* [m-p]* zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-d.gz
chmod 444 ${FTP_ARCHIVE}-d.gz
echo "${FTP_ARCHIVE}-d.gz created (core 3)"
/usr/gnu/bin/tar -cvf - -X ${EXCLUDE} Copy* README [m-t]* [u-z]* zzzEND |\
tar -cvf - -X ${EXCLUDE} Copy* README [q-z]* zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-e.gz
chmod 444 ${FTP_ARCHIVE}-e.gz
echo "${FTP_ARCHIVE}-e.gz created (core 4)"
/usr/gnu/bin/tar cfv - Copy* README pix zzzEND |\
tar cfv - Copy* README pix zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-f.gz
chmod 444 ${FTP_ARCHIVE}-f.gz
echo "${FTP_ARCHIVE}-f.gz created (pix)"
/usr/gnu/bin/tar cfv - Copy* README vfont zzzEND |\
tar cfv - Copy* README vfont zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-g.gz
chmod 444 ${FTP_ARCHIVE}-g.gz
echo "${FTP_ARCHIVE}-g.gz created (vfont)"
/usr/gnu/bin/tar cfv - Copy* README pro-engineer zzzEND |\
tar cfv - Copy* README pro-engineer zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-h.gz
chmod 444 ${FTP_ARCHIVE}-h.gz
echo "${FTP_ARCHIVE}-h.gz created (pro-engineer)"
/usr/gnu/bin/tar cfv - Copy* README libtcl libtk zzzEND |\
tar cfv - Copy* README libtcl libtk libitcl zzzEND |\
gzip -9 > ${FTP_ARCHIVE}-i.gz
chmod 444 ${FTP_ARCHIVE}-i.gz
echo "${FTP_ARCHIVE}-i.gz created (libtcl libtk)"
echo "${FTP_ARCHIVE}-i.gz created (libtcl libtk libitcl)"
rm -f ${EXCLUDE}
# Select available encryption utility
echo "Hello" | crypt key > /dev/null 2>&1
if test $? -gt 0
then
COMMAND=enigma
else
COMMAND=crypt
fi
if test ${DO_ENCRYPTION} -eq 1
then
for FILE in ${FTP_ARCHIVE}-*.gz ; do
crypt ${KEY} < ${FILE} > ${FILE}.crypt
$COMMAND ${KEY} < ${FILE} > ${FILE}.crypt
rm -f ${FILE}
done
else
-15
View File
@@ -82,9 +82,6 @@ extern "C" {
* if( fabs(VDOT(a,b)) >= tol->para ) a & b are parallel
* if( fabs(VDOT(a,b)) <= tol->perp ) a & b are perpendicular
*
* Note:
* tol->dist_sq = tol->dist * tol->dist;
* tol->para = 1 - tol->perp;
*/
struct bn_tol {
unsigned long magic;
@@ -103,18 +100,6 @@ struct bn_tol {
#define BN_APPROXEQUAL(_a, _b, _tol) (fabs( (_a) - (_b) ) <= _tol->dist)
/* asize.c */
BU_EXTERN(int bn_common_file_size, (int *width,
int *height,
char *filename,
int pixel_size));
BU_EXTERN(int bn_common_name_size, (int *width,
int *height,
char *name));
BU_EXTERN(int bn_common_image_zie, (int *width,
int *height,
int num_pixels));
/*----------------------------------------------------------------------*/
/* complex.c */
/*
+1 -90
View File
@@ -222,19 +222,6 @@ extern char *realloc();
}
#endif
/*----------------------------------------------------------------------*/
/*
* Sizes of "network" format data.
* We use the same convention as the TCP/IP specification,
* namely, big-Endian, IEEE format, twos compliment.
* This is the BRL-CAD external data representation (XDR).
* See also the support routines in libbu/xdr.c
*/
#define SIZEOF_NETWORK_SHORT 2 /* htons(), bu_gshort(), bu_pshort() */
#define SIZEOF_NETWORK_LONG 4 /* htonl(), bu_glong(), bu_plong() */
#define SIZEOF_NETWORK_FLOAT 4 /* htonf() */
#define SIZEOF_NETWORK_DOUBLE 8 /* htond() */
/*----------------------------------------------------------------------*/
/* list.c */
/*
@@ -754,53 +741,6 @@ struct bu_mapped_file {
typedef int (*bu_hook_t)BU_ARGS((genptr_t, genptr_t));
#define BUHOOK_NULL 0
/*----------------------------------------------------------------------*/
/* avs.c */
/*
* Attribute/value sets
*/
/*
* B U _ A T T R I B U T E _ V A L U E _ P A I R
*
* These strings may or may not be individually allocated,
* it depends on usage.
*/
struct bu_attribute_value_pair {
const char *name;
const char *value;
};
/*
* B U _ A T T R I B U T E _ V A L U E _ S E T
*
* A variable-sized attribute-value-pair array.
*
* avp points to an array of [max] slots.
* The interface routines will realloc to extend as needed.
*
* In general,
* each of the names and values is a local copy made with bu_strdup(),
* and each string needs to be freed individually.
* However, if a name or value pointer is between
* readonly_min and readonly_max, then it is part of a big malloc
* block that is being freed by the caller, and should not be individually
* freed.
*/
struct bu_attribute_value_set {
long magic;
int count; /* # valid entries in avp */
int max; /* # allocated slots in avp */
struct bu_attribute_value_pair *avp; /* array[max] */
char *readonly_min;
char *readonly_max;
};
#define BU_AVS_MAGIC 0x41765321 /* AvS! */
#define BU_CK_AVS(_avp) BU_CKMAG(_avp, BU_AVS_MAGIC, "bu_attribute_value_set")
#define BU_AVS_FOR(_pp, _avp) \
(_pp) = &(_avp)->avp[(_avp)->count-1]; (_pp) >= (_avp)->avp; (_pp)--
/*----------------------------------------------------------------------*/
/* vls.c */
/*
@@ -859,7 +799,6 @@ extern int bu_debug;
#define BU_DEBUG_MATH 0x00000100 /* 011 Fundamental math routines (plane.c, mat.c) */
#define BU_DEBUG_PTBL 0x00000200 /* 012 bu_ptbl_*() logging */
#define BU_DEBUG_AVS 0x00000400 /* 013 bu_avs_*() logging */
#define BU_DEBUG_TABDATA 0x00010000 /* 025 LIBBN: tabdata */
@@ -868,7 +807,7 @@ extern int bu_debug;
"\020\
\025TABDATA\
\015?\
\013AVS\012PTBL\011MATH\010?\7?\6?\5PARALLEL\
\012PTBL\011MATH\010?\7?\6?\5PARALLEL\
\4?\3MEM_LOG\2MEM_CHECK\1COREDUMP"
/*----------------------------------------------------------------------*/
@@ -952,8 +891,6 @@ struct bu_structparse {
/*----------------------------------------------------------------------*/
/*
* B U _ E X T E R N A L
*
* An "opaque" handle for holding onto objects,
* typically in some kind of external form that is not directly
* usable without passing through an "importation" function.
@@ -1156,23 +1093,6 @@ struct bu_observer {
* Source file names listed alphabetically.
*/
/* avs.c */
BU_EXTERN(void bu_avs_init, (struct bu_attribute_value_set *avp,
int len, CONST char *str));
BU_EXTERN(struct bu_attribute_value_set *bu_avs_new, (int len, CONST char *str));
BU_EXTERN(int bu_avs_add, (struct bu_attribute_value_set *avp,
CONST char *attribute,
CONST char *value));
extern int bu_avs_add_vls(struct bu_attribute_value_set *avp,
const char *attribute,
const struct bu_vls *value_vls);
extern const char * bu_avs_get( const struct bu_attribute_value_set *avp,
const char *attribute );
BU_EXTERN(int bu_avs_remove, (struct bu_attribute_value_set *avp,
CONST char *attribute));
BU_EXTERN(void bu_avs_free, (struct bu_attribute_value_set *avp));
extern void bu_avs_print( const struct bu_attribute_value_set *avp, const char *title );
/* badmagic.c */
BU_EXTERN(void bu_badmagic, (CONST long *ptr, long magic,
CONST char *str, CONST char *file, int line));
@@ -1249,12 +1169,6 @@ BU_EXTERN(void htond, (unsigned char *out,
BU_EXTERN(void ntohd, (unsigned char *out,
CONST unsigned char *in, int count));
/* htonf.c */
BU_EXTERN(void htonf, (unsigned char *out,
CONST unsigned char *in, int count));
BU_EXTERN(void ntohf, (unsigned char *out,
CONST unsigned char *in, int count));
/* ispar.c */
BU_EXTERN(int bu_is_parallel, () );
BU_EXTERN(void bu_kill_parallel, () );
@@ -1367,9 +1281,6 @@ BU_EXTERN( int bu_key_eq_to_key_val, (char *in, char **next, st
BU_EXTERN( int bu_shader_to_tcl_list, (char *in, struct bu_vls *vls) );
BU_EXTERN( int bu_key_val_to_key_eq, (char *in) );
BU_EXTERN( int bu_shader_to_key_eq, (char *in, struct bu_vls *vls) );
int bu_fwrite_external( FILE *fp, const struct bu_external *ep );
void bu_hexdump_external( FILE *fp, CONST struct bu_external *ep, CONST char *str);
void bu_free_external(struct bu_external *ep);
/* printb.c */
BU_EXTERN(void bu_vls_printb, (struct bu_vls *vls,
+25 -1
View File
@@ -59,6 +59,8 @@
* HAVE_SBRK Set if unistd.h declares sbrk().
* HAVE_UNIX_DOMAIN_SOCKETS
*
* HAVE_UNISTD_H Set if unistd.h exists
*
* HAVE_DLOPEN Dynamic library loading support.
*
* $Header$
@@ -122,6 +124,7 @@
# define HAVE_SBRK_DECL 1
# define HAVE_REGEX_DECL 1
# define HAVE_POSIX_REGEXEC 1
# define HAVE_DLOPEN 1
#endif
#if defined(_AIX) || defined(__AIX)
@@ -233,12 +236,33 @@
#if defined(linux)
# define _BSD_SOURCE 1 /* for sys/types.h to define caddr_t */
# define STDIN_FILENO 0
# define HAVE_GETOPT 1
# define HAVE_GETOPT_H 1
# define HAVE_GETOPT_DECL 1
# define HAVE_STRDUP_DECL 1
# define HAVE_XOSDEFS_H 1
# define HAVE_SYS_ERRLIST_DECL 1
# define HAVE_POSIX_REGEXEC 1
# define HAVE_DLOPEN 1
# define HAVE_UNISTD_H 1
# define HAVE_STDLIB_H 1
# define HAVE_GETOPT_H 1
# define HAVE_XOSDEFS_H 1
# define HAVE_STRING_H 1
# define HAVE_POSIX_REGEXEC 1
# define HAVE_STRCHR 1
# define HAVE_VFORK 1
# define HAVE_VPRINTF 1
# define HAVE_WRITEV 1
# define HAVE_SBRK 1
# define HAVE_DLOPEN 1
# define HAVE_UNIX_DOMAIN_SOCKETS 1
# define HAVE_SHELL_ESCAPE 1
# define HAVE_UNIX_IO 1
# define HAVE_DRAND48 1
# define HAVE_TERMIOS_H 1
# define HAVE_SYS_MMAN_H 1
# define HAVE_LIMITS_H 1
# define HAVE_BZERO 1
# define TK_READ_DATA_PENDING(f) ((f)->_IO_read_ptr != (f)->_IO_read_end)
#endif
+1
View File
@@ -205,6 +205,7 @@ union record {
char c_id; /* ID_COMB */
char c_flags; /* `R' if region, else ` ' */
#define DBV4_NON_REGION ' '
#define DBV4_NON_REGION_NULL '\0'
#define DBV4_REGION 'R'
#define DBV4_REGION_FASTGEN_PLATE 'P'
#define DBV4_REGION_FASTGEN_VOLUME 'V'
+32 -107
View File
@@ -28,11 +28,10 @@
struct db5_ondisk_header {
unsigned char db5h_magic1; /* [0] */
unsigned char db5h_hflags; /* [1] */
unsigned char db5h_aflags; /* [2] */
unsigned char db5h_bflags; /* [3] */
unsigned char db5h_major_type; /* [4] */
unsigned char db5h_minor_type; /* [5] */
/* Next is a mandatory variable-size length field starting at [6] */
unsigned char db5h_iflags; /* [2] */
unsigned char db5h_major_type; /* [3] */
unsigned char db5h_minor_type; /* [4] */
/* Next is a mandatory variable-size length field starting at [5] */
/* Next are optional object name length & data fields */
};
@@ -47,25 +46,28 @@ struct db5_ondisk_header {
#define DB5HDR_HFLAGS_NAME_PRESENT 0x20
#define DB5HDR_HFLAGS_OBJECT_WIDTH_MASK 0xc0
#define DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT 6
#define DB5HDR_HFLAGS_NAME_WIDTH_MASK 0x18
#define DB5HDR_HFLAGS_NAME_WIDTH_SHIFT 3
#define DB5HDR_WIDTHCODE_8BIT 0
#define DB5HDR_WIDTHCODE_16BIT 1
#define DB5HDR_WIDTHCODE_32BIT 2
#define DB5HDR_WIDTHCODE_64BIT 3
/* aflags */
#define DB5HDR_AFLAGS_ZZZ_MASK 0x07
#define DB5HDR_AFLAGS_PRESENT 0x20
#define DB5HDR_AFLAGS_WIDTH_MASK 0xc0
#define DB5HDR_AFLAGS_WIDTH_SHIFT 6
/* iflags */
#define DB5HDR_IFLAGS_ZZZ_MASK 0x07
#define DB5HDR_IFLAGS_ZZZ_UNCOMPRESSED 0
#define DB5HDR_IFLAGS_ZZZ_GNU_GZIP 1
#define DB5HDR_IFLAGS_ZZZ_BURROUGHS_WHEELER 2
#define DB5HDR_IFLAGS_ATTRIBUTES_PRESENT 0x20
#define DB5HDR_IFLAGS_BODY_PRESENT 0x10
#define DB5HDR_IFLAGS_INTERIOR_WIDTH_MASK 0xc0
#define DB5HDR_IFLAGS_INTERIOR_WIDTH_SHIFT 6
/* bflags */
#define DB5HDR_BFLAGS_ZZZ_MASK 0x07
#define DB5HDR_BFLAGS_PRESENT 0x20
#define DB5HDR_BFLAGS_WIDTH_MASK 0xc0
#define DB5HDR_BFLAGS_WIDTH_SHIFT 6
/* major_type */
#define DB5HDR_MAJORTYPE_RESERVED 0
#define DB5HDR_MAJORTYPE_BRLCAD_NONGEOM 1
#define DB5HDR_MAJORTYPE_BRLCAD_GEOMETRY 2
#define DB5HDR_MAJORTYPE_OPAQUE_BINARY 3
#define DB5HDR_MAJORTYPE_ATTRIBUTE_ONLY 4
/*************************************************************************
*
@@ -75,74 +77,6 @@ struct db5_ondisk_header {
*
************************************************************************/
/* Name of global attribute-only object for storing database title & units */
#define DB5_GLOBAL_OBJECT_NAME "_GLOBAL"
/* Kinds of compression */
#define DB5_ZZZ_UNCOMPRESSED 0
#define DB5_ZZZ_GNU_GZIP 1
#define DB5_ZZZ_BURROUGHS_WHEELER 2
/* major_type */
#define DB5_MAJORTYPE_RESERVED 0
#define DB5_MAJORTYPE_BRLCAD 1
#define DB5_MAJORTYPE_ATTRIBUTE_ONLY 2
#define DB5_MAJORTYPE_BINARY_MASK 0x18
#define DB5_MAJORTYPE_BINARY_EXPM 8
#define DB5_MAJORTYPE_BINARY_UNIF 9
#define DB5_MAJORTYPE_BINARY_MIME 10
/*
* Minor types
*/
/* BRL-CAD */
#define DB5_MINORTYPE_BRLCAD_TOR 1
#define DB5_MINORTYPE_BRLCAD_TGC 2
#define DB5_MINORTYPE_BRLCAD_ELL 3
#define DB5_MINORTYPE_BRLCAD_ARB8 4
#define DB5_MINORTYPE_BRLCAD_ARS 5
#define DB5_MINORTYPE_BRLCAD_HALF 6
#define DB5_MINORTYPE_BRLCAD_REC 7
#define DB5_MINORTYPE_BRLCAD_POLY 8
#define DB5_MINORTYPE_BRLCAD_BSPLINE 9
#define DB5_MINORTYPE_BRLCAD_SPH 10
#define DB5_MINORTYPE_BRLCAD_NMG 11
#define DB5_MINORTYPE_BRLCAD_EBM 12
#define DB5_MINORTYPE_BRLCAD_VOL 13
#define DB5_MINORTYPE_BRLCAD_ARBN 14
#define DB5_MINORTYPE_BRLCAD_PIPE 15
#define DB5_MINORTYPE_BRLCAD_PARTICLE 16
#define DB5_MINORTYPE_BRLCAD_RPC 17
#define DB5_MINORTYPE_BRLCAD_RHC 18
#define DB5_MINORTYPE_BRLCAD_EPA 19
#define DB5_MINORTYPE_BRLCAD_EHY 20
#define DB5_MINORTYPE_BRLCAD_ETO 21
#define DB5_MINORTYPE_BRLCAD_GRIP 22
#define DB5_MINORTYPE_BRLCAD_JOINT 23
#define DB5_MINORTYPE_BRLCAD_HF 24
#define DB5_MINORTYPE_BRLCAD_DSP 25
#define DB5_MINORTYPE_BRLCAD_SKETCH 26
#define DB5_MINORTYPE_BRLCAD_EXTRUDE 27
#define DB5_MINORTYPE_BRLCAD_SUBMODEL 28
#define DB5_MINORTYPE_BRLCAD_CLINE 29
#define DB5_MINORTYPE_BRLCAD_BOT 30
#define DB5_MINORTYPE_BRLCAD_COMBINATION 31
/* Uniform-array binary */
#define DB5_MINORTYPE_BINU_WID_MASK 0x30
#define DB5_MINORTYPE_BINU_SGN_MASK 0x08
#define DB5_MINORTYPE_BINU_ATM_MASK 0x07
#define DB5_MINORTYPE_BINU_FLOAT 0x02
#define DB5_MINORTYPE_BINU_DOUBLE 0x03
#define DB5_MINORTYPE_BINU_8BITINT_U 0x04
#define DB5_MINORTYPE_BINU_16BITINT_U 0x05
#define DB5_MINORTYPE_BINU_32BITINT_U 0x06
#define DB5_MINORTYPE_BINU_64BITINT_U 0x07
#define DB5_MINORTYPE_BINU_8BITINT 0x0c
#define DB5_MINORTYPE_BINU_16BITINT 0x0d
#define DB5_MINORTYPE_BINU_32BITINT 0x0e
#define DB5_MINORTYPE_BINU_64BITINT 0x0f
/*
* The "raw internal" form of one database object.
* This is what the low-level database routines will operate on.
@@ -151,35 +85,26 @@ struct db5_ondisk_header {
struct db5_raw_internal {
long magic;
unsigned char h_object_width; /* DB5HDR_WIDTHCODE_x */
unsigned char h_name_present;
unsigned char h_name_width; /* DB5HDR_WIDTHCODE_x */
unsigned char h_dli;
unsigned char a_width; /* DB5HDR_WIDTHCODE_x */
unsigned char a_present;
unsigned char a_zzz;
unsigned char b_width; /* DB5HDR_WIDTHCODE_x */
unsigned char b_present;
unsigned char b_zzz;
unsigned char h_name_present;
unsigned char i_object_width; /* DB5HDR_WIDTHCODE_x */
unsigned char i_attributes_present;
unsigned char i_body_present;
unsigned char i_zzz;
unsigned char major_type;
unsigned char minor_type;
long object_length; /* in bytes, on disk */
/* These three MUST NOT be passed to bu_free_external()! */
struct bu_external name;
struct bu_external body;
struct bu_external attributes;
long name_length;
char *name;
long interior_length;
unsigned char *interior;
unsigned char *buf; /* if non-null needs to be bu_free()ed */
};
#define DB5_RAW_INTERNAL_MAGIC 0x64357269 /* "d5ri" */
extern const int db5_enc_len[4]; /* convert wid to nbytes */
extern unsigned char *db5_encode_length(
unsigned char *cp,
long val,
int format);
const unsigned char *db5_get_raw_internal_ptr(
struct db5_raw_internal *rip,
const unsigned char *ip);
struct attribute_value_pair {
char *name;
char *value;
};
#endif /* DB5_H */
+8 -1
View File
@@ -173,6 +173,7 @@ struct dm {
int dm_light; /* !0 means lighting on */
int dm_zbuffer; /* !0 means zbuffer on */
int dm_zclip; /* !0 means zclipping */
Tcl_Interp *dm_interp; /* Tcl interpreter */
};
/*
@@ -188,7 +189,6 @@ struct dm_obj {
struct fbserv_obj dmo_fbs; /* fbserv object */
#endif
struct bu_observer dmo_observers; /* fbserv observers */
Tcl_Interp *dmo_interp; /* Tcl interpreter */
};
#define DM_OPEN(_type,_argc,_argv) dm_open(_type,_argc,_argv)
@@ -232,8 +232,15 @@ extern unsigned Nu_unsign();
extern void dm_configureWindowShape();
extern void dm_zbuffer();
extern void dm_lighting();
#if 0
extern Tcl_Interp *interp; /* This must be defined by the application */
#endif
/* vers.c (created by libdm/Cakefile) */
extern char dm_version[];
/* clip.c */
extern int clip(vect_t, vect_t, vect_t, vect_t);
extern int vclip(vect_t, vect_t, register fastf_t *, register fastf_t *);
#endif /* SEEN_DM_H */
+11 -96
View File
@@ -214,12 +214,10 @@ struct rt_db_internal {
int idb_type; /* ID_xxx */
CONST struct rt_functab *idb_meth; /* for ft_ifree(), etc. */
genptr_t idb_ptr;
struct bu_attribute_value_set idb_avs;
};
#define RT_DB_INTERNAL_MAGIC 0x0dbbd867
#define RT_INIT_DB_INTERNAL(_p) {(_p)->idb_magic = RT_DB_INTERNAL_MAGIC; \
(_p)->idb_type = -1; (_p)->idb_ptr = GENPTR_NULL;\
(_p)->idb_avs.magic = -1;}
(_p)->idb_type = -1; (_p)->idb_ptr = GENPTR_NULL;}
#define RT_CK_DB_INTERNAL(_p) BU_CKMAG(_p, RT_DB_INTERNAL_MAGIC, "rt_db_internal")
/*
@@ -517,16 +515,9 @@ struct soltab {
#define ID_SUBMODEL 28 /* Instanced submodel */
#define ID_CLINE 29 /* FASTGEN4 CLINE solid */
#define ID_BOT 30 /* Bag o' triangles */
#define ID_MAX_SOLID 30 /* Maximum defined ID_xxx for solids */
#define ID_MAXIMUM 30 /* Maximum defined ID_xxx value */
/*
* Non-geometric objects
*/
#define ID_COMBINATION 31 /* Combination Record */
#define ID_BINEXPM 32 /* Experimental binary */
#define ID_BINUNIF 33 /* Uniform-array binary */
#define ID_BINMIME 34 /* MIME-typed binary */
#define ID_MAXIMUM 35 /* Maximum defined ID_xxx value */
#define ID_COMBINATION (ID_MAXIMUM+1) /* Combination Record (non-geometric) */
/*
* M A T E R _ I N F O
@@ -842,35 +833,6 @@ struct rt_comb_internal {
#define RT_CHECK_COMB_TCL(_interp,_p) BU_CKMAG_TCL(interp,_p,RT_COMB_MAGIC, "rt_comb_internal" )
#define RT_CK_COMB_TCL(_interp,_p) RT_CHECK_COMB_TCL(_interp,_p)
/*
* R T _ B I N U N I F _ I N T E R N A L
*
* In-memory format for database uniform-array binary object.
* Perhaps move to h/wdb.h or h/rtgeom.h?
*/
struct rt_binunif_internal {
long magic;
char type;
long count;
union {
float *flt;
double *dbl;
char *int8;
short *int16;
int *int32;
long *int64;
unsigned char *uint8;
unsigned short *uint16;
unsigned int *uint32;
unsigned long *uint64;
} u;
};
#define RT_BINUNIF_INTERNAL_MAGIC 0x42696e55 /* "BinU" */
#define RT_CHECK_BINUNIF(_p) BU_CKMAG( _p , RT_BINUNIF_INTERNAL_MAGIC , "rt_binunif_internal" )
#define RT_CK_BINUNIF(_p) RT_CHECK_BINUNIF(_p)
#define RT_CHECK_BINUNIF_TCL(_interp,_p) BU_CKMAG_TCL(interp,_p,RT_BINUNIF_MAGIC, "rt_binunif_internal" )
#define RT_CK_BINUNIF_TCL(_interp,_p) RT_CHECK_BINUNIF_TCL(_interp,_p)
/*
* D B _ T R E E _ S T A T E
*
@@ -906,7 +868,8 @@ struct db_tree_state {
union tree * (*ts_leaf_func) BU_ARGS((
struct db_tree_state * /*tsp*/,
struct db_full_path * /*pathp*/,
struct rt_db_internal * /*ip*/,
struct bu_external * /*ep*/,
int /*id*/,
genptr_t client_data
));
CONST struct rt_tess_tol *ts_ttol; /* Tessellation tolerance */
@@ -1553,8 +1516,8 @@ struct rt_i {
int rti_ncut_by_type[CUT_MAXIMUM+1]; /* number of cuts by type */
int rti_cut_totobj; /* # objs in all bins, total */
int rti_cut_maxdepth;/* max depth of cut tree */
struct soltab **rti_sol_by_type[ID_MAX_SOLID+1];
int rti_nsol_by_type[ID_MAX_SOLID+1];
struct soltab **rti_sol_by_type[ID_MAXIMUM+1];
int rti_nsol_by_type[ID_MAXIMUM+1];
int rti_maxsol_by_type;
int rti_air_discards;/* # of air regions discarded */
struct bu_hist rti_hist_cellsize; /* occupancy of cut cells */
@@ -1793,14 +1756,6 @@ struct rt_functab {
struct rt_db_internal * /*ip*/,
CONST struct bn_tol * /*tol*/));
#endif
int (*ft_import5) BU_ARGS((struct rt_db_internal * /*ip*/,
CONST struct bu_external * /*ep*/,
CONST mat_t /*mat*/,
CONST struct db_i * /*dbip*/));
int (*ft_export5) BU_ARGS((struct bu_external * /*ep*/,
CONST struct rt_db_internal * /*ip*/,
double /*local2mm*/,
CONST struct db_i * /*dbip*/));
int (*ft_import) BU_ARGS((struct rt_db_internal * /*ip*/,
CONST struct bu_external * /*ep*/,
CONST mat_t /*mat*/,
@@ -2442,7 +2397,8 @@ BU_EXTERN(int db_walk_tree, (struct db_i *dbip, int argc, CONST char **argv,
union tree * (*leaf_func) (
struct db_tree_state * /*tsp*/,
struct db_full_path * /*pathp*/,
struct rt_db_internal * /*ip*/,
struct bu_external * /*ep*/,
int /*id*/,
genptr_t client_data ),
genptr_t client_data ));
BU_EXTERN(int db_path_to_mat, (struct db_i *dbip, struct db_full_path *pathp,
@@ -2452,16 +2408,11 @@ BU_EXTERN(void db_apply_anims, (struct db_full_path *pathp,
struct mater_info *materp));
/* dir.c */
extern struct rt_i *rt_dirbuild( const char *filename, char *buf, int len );
BU_EXTERN(int rt_db_get_internal, (struct rt_db_internal *ip,
CONST struct directory *dp,
CONST struct db_i *dbip, CONST mat_t mat));
BU_EXTERN(int rt_db_put_internal, (struct directory *dp, struct db_i *dbip,
struct rt_db_internal *ip));
extern int rt_fwrite_internal( FILE *fp, const char *name, const struct rt_db_internal *ip, double conv2mm );
extern void rt_db_free_internal( struct rt_db_internal *ip );
extern int rt_db_lookup_internal( struct db_i *dbip, const char *obj_name,
struct directory **dpp, struct rt_db_internal *ip, int noisy );
/* db_comb.c */
@@ -2481,7 +2432,6 @@ BU_EXTERN(struct rt_pt_node *rt_ptalloc, () );
/* memalloc.c -- non PARALLEL routines */
BU_EXTERN(unsigned long rt_memalloc, (struct mem_map **pp, unsigned size) );
BU_EXTERN(struct mem_map * rt_memalloc_nosplit, (struct mem_map **pp, unsigned size) );
BU_EXTERN(unsigned long rt_memget, (struct mem_map **pp, unsigned int size,
unsigned int place) );
BU_EXTERN(void rt_memfree, (struct mem_map **pp, unsigned size, unsigned long addr) );
@@ -3306,10 +3256,10 @@ BU_EXTERN(int nmg_two_region_vertex_fuse, (struct nmgregion *r1,
struct nmgregion *r2, CONST struct bn_tol *tol));
BU_EXTERN(union tree *nmg_booltree_leaf_tess, (struct db_tree_state *tsp,
struct db_full_path *pathp,
struct rt_db_internal *ip, genptr_t client_data));
struct bu_external *ep, int id, genptr_t client_data));
BU_EXTERN(union tree *nmg_booltree_leaf_tnurb, (struct db_tree_state *tsp,
struct db_full_path *pathp,
struct rt_db_internal *ip, genptr_t client_data));
struct bu_external *ep, int id, genptr_t client_data));
BU_EXTERN(union tree *nmg_booltree_evaluate, (union tree *tp,
CONST struct bn_tol *tol));
BU_EXTERN(void nmg_region_v_unique, (struct nmgregion *r1,
@@ -3913,41 +3863,6 @@ BU_EXTERN(void nmg_visit,
CONST struct nmg_visit_handlers *htab,
genptr_t *state));
/* db5_types.c */
BU_EXTERN(int db5_type_tag_from_major,
(char **tag,
CONST unsigned char major));
BU_EXTERN(int db5_type_descrip_from_major,
(char **descrip,
CONST unsigned char major));
BU_EXTERN(int db5_type_tag_from_codes,
(char **tag,
CONST unsigned char major,
CONST unsigned char minor));
BU_EXTERN(int db5_type_descrip_from_codes,
(char **descrip,
CONST unsigned char major,
CONST unsigned char minor));
BU_EXTERN(int db5_type_codes_from_tag,
(unsigned char *major,
unsigned char *minor,
CONST char *tag));
BU_EXTERN(int db5_type_codes_from_descrip,
(unsigned char *major,
unsigned char *minor,
CONST char *descrip));
BU_EXTERN(size_t db5_type_sizeof_h_binu,
(CONST unsigned char minor));
BU_EXTERN(size_t db5_type_sizeof_n_binu,
(CONST unsigned char minor));
#endif
/*
+8 -5
View File
@@ -359,10 +359,13 @@ struct rt_eto_internal {
#define DSP_NAME_LEN 128
struct rt_dsp_internal{
long magic;
struct bu_vls dsp_file; /* name of data file */
unsigned int dsp_xcnt; /* # samples in row of data */
unsigned int dsp_ycnt; /* # of columns in data */
unsigned short dsp_smooth; /* bool: surf normal interp */
char dsp_file[DSP_NAME_LEN]; /* name of data file */
unsigned dsp_xcnt; /* # samples in row of data */
unsigned dsp_ycnt; /* # of columns in data */
int dsp_smooth; /* bool: surf normal interp */
double dsp_xs;
double dsp_ys;
double dsp_zs;
mat_t dsp_mtos; /* model to solid space */
/* END OF USER SETABLE VARIABLES, BEGIN INTERNAL STUFF */
mat_t dsp_stom; /* solid to model space */
@@ -424,7 +427,7 @@ struct rt_extrude_internal
vect_t u_vec; /* vector in U parameter direction */
vect_t v_vec; /* vector in V parameter direction */
int keypoint; /* index of keypoint vertex */
char *sketch_name; /* name of sketch object that defines
char sketch_name[SKETCH_NAME_LEN]; /* name of sketch object that defines
* the curve to be extruded */
struct rt_sketch_internal *skt; /* pointer to referenced sketch */
};
+5 -5
View File
@@ -3137,7 +3137,6 @@ will also be changed. The <a href="#mvall">mvall</a> command performs a similar
<DT><a NAME="press"><B>press</B> <I>button_label</I></DT>
<DD>The ``press'' command simulates the pressing of a button.
All of these button actions can be be run directly as a command.
The <I>button_label</I> indicates which button to simulate.
The available buttons are:
@@ -3184,6 +3183,7 @@ The available buttons are:
the viewing cube (the eye rotates about the center if the viewing cube). In
``rotate about eye'' mode the view rotations are done about the eye point
(the eye rotates in position as in panning a camera)</li>
<li>slice -- ??????????????????????</li>
</ul>
<DL>
@@ -4442,10 +4442,10 @@ The parameters are (in order):
<DT><a NAME="translate"><B>translate</B> <I>x y z</I></DT>
<DD>The ``translate'' command is used to precisely control
the translation of an object in both solid edit and object edit modes.
The keypoint of the edited object or solid is translated to the specified
coordinates.
<DD>The ``translate'' command is used in object edit mode to precisely control
the translation of an object. The edited object is translated to the specified
coordinates. The <a href="#p">p</a> command provides a similar capability for
solid editing.
<DL>
+56 -180
View File
@@ -20,7 +20,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char RCSid[] = "@(#)$Header$ (ARL)";
static char RCSid[] = "@(#)$Header$ (ARL)";
#endif
@@ -66,34 +66,10 @@ char *str;
&m[8], &m[9], &m[10], &m[11], &m[12], &m[13], &m[14], &m[15]);
}
/*
* B N _ D E C O D E _ T O L
*
* If the user specifies {}, or only the distance tolerance,
* provide the same defaults that LIBRT uses.
*/
int
bn_decode_tol(tol, str)
struct bn_tol *tol;
const char *str;
{
tol->magic = BN_TOL_MAGIC;
/* provide meaningful defaults */
tol->dist = 0.005;
tol->perp = 1e-6;
if( *str == '{' ) str++;
(void)sscanf(str, "%lf %lf", &tol->dist, &tol->perp);
tol->dist_sq = tol->dist * tol->dist;
tol->para = 1 - tol->perp;
return 2; /* You always get something good */
}
int
bn_decode_quat(q, str)
quat_t q;
const char *str;
char *str;
{
if( *str == '{' ) str++;
return sscanf(str, "%lf %lf %lf %lf", &q[0], &q[1], &q[2], &q[3]);
@@ -102,7 +78,7 @@ const char *str;
int
bn_decode_vect(v, str)
vect_t v;
const char *str;
char *str;
{
if( *str == '{' ) str++;
return sscanf(str, "%lf %lf %lf", &v[0], &v[1], &v[2]);
@@ -111,37 +87,23 @@ const char *str;
int
bn_decode_hvect(v, str)
hvect_t v;
const char *str;
char *str;
{
if( *str == '{' ) str++;
return sscanf(str, "%lf %lf %lf %lf", &v[0], &v[1], &v[2], &v[3]);
}
int
bn_decode_plane(v, str)
plane_t v;
const char *str;
{
if( *str == '{' ) str++;
return sscanf(str, "%lf %lf %lf %lf", &v[0], &v[1], &v[2], &v[3]);
}
/*
* Encoding routines.
* All these tuples should be wrapped in {}s.
*/
void
bn_encode_mat(vp, m)
struct bu_vls *vp;
const mat_t m;
mat_t m;
{
if( m == NULL ) {
bu_vls_putc(vp, 'I');
return;
}
bu_vls_printf(vp, "{%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g} ",
bu_vls_printf(vp, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g",
m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7],
m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15]);
}
@@ -149,36 +111,31 @@ const mat_t m;
void
bn_encode_quat(vp, q)
struct bu_vls *vp;
const quat_t q;
quat_t q;
{
bu_vls_printf(vp, "{%g %g %g %g} ", V4ARGS(q));
bu_vls_printf(vp, "%g %g %g %g", V4ARGS(q));
}
void
bn_encode_vect(vp, v)
struct bu_vls *vp;
const vect_t v;
vect_t v;
{
bu_vls_printf(vp, "{%g %g %g} ", V3ARGS(v));
bu_vls_printf(vp, "%g %g %g", V3ARGS(v));
}
void
bn_encode_hvect(vp, v)
struct bu_vls *vp;
const hvect_t v;
hvect_t v;
{
bu_vls_printf(vp, "{%g %g %g %g} ", V4ARGS(v));
bu_vls_printf(vp, "%g %g %g %g", V4ARGS(v));
}
/*
* Wrappers for macros and multiple-return-value functions
*/
void
bn_quat_distance_wrapper(dp, q1, q2)
double *dp;
const quat_t q1;
const quat_t q2;
quat_t q1, q2;
{
*dp = quat_distance(q1, q2);
}
@@ -228,16 +185,16 @@ CONST vect_t dir;
}
/*
* B N _ M A T H _ C M D _ V O I D
* B N _ M A T H _ C M D
*
* Tcl wrappers for the math functions of type void.
* Tcl wrappers for the math functions.
*
* This is where you should put clauses, in the below "if" statement, to add
* Tcl support for the LIBBN math routines.
*/
int
bn_math_cmd_void(clientData, interp, argc, argv)
bn_math_cmd(clientData, interp, argc, argv)
ClientData clientData;
Tcl_Interp *interp;
int argc;
@@ -581,120 +538,46 @@ error:
return TCL_ERROR;
}
static struct math_func_link_void {
static struct math_func_link {
char *name;
void (*func)();
} math_funcs_void[] = {
{"mat_mul", bn_mat_mul},
{"mat_inv", bn_mat_inv},
{"mat_trn", bn_mat_trn},
{"matXvec", bn_matXvec},
{"mat4x3vec", bn_mat4x3vec},
{"mat4x3pnt", bn_mat4x3pnt},
{"hdivide", bn_hdivide},
{"vjoin1", bn_vjoin1},
{"mat_ae", bn_mat_ae},
{"mat_ae_vec", bn_ae_vec}, /* wrong name! */
{"bn_ae_vec", bn_ae_vec},
{"mat_aet_vec", bn_aet_vec},
{"bn_aet_vec", bn_aet_vec}, /* wrong name! */
{"mat_angles", bn_mat_angles},
{"mat_eigen2x2", bn_eigen2x2},
{"mat_fromto", bn_mat_fromto},
{"mat_xrot", bn_mat_xrot},
{"mat_yrot", bn_mat_yrot},
{"mat_zrot", bn_mat_zrot},
{"mat_lookat", bn_mat_lookat},
{"mat_vec_ortho", bn_vec_ortho}, /* wrong name! */
{"bn_vec_ortho", bn_vec_ortho},
{"mat_vec_perp", bn_vec_perp}, /* wrong name! */
{"bn_vec_perp", bn_vec_perp},
{"mat_scale_about_pt", bn_mat_scale_about_pt_wrapper},
{"mat_xform_about_pt", bn_mat_xform_about_pt},
{"mat_arb_rot", bn_mat_arb_rot},
{"quat_mat2quat", quat_mat2quat},
{"quat_quat2mat", quat_quat2mat},
{"quat_distance", bn_quat_distance_wrapper},
{"quat_double", quat_double},
{"quat_bisect", quat_bisect},
{"quat_slerp", quat_slerp},
{"quat_sberp", quat_sberp},
{"quat_make_nearest", quat_make_nearest},
{"quat_exp", quat_exp},
{"quat_log", quat_log},
{0, 0}
} math_funcs[] = {
"mat_mul", bn_mat_mul,
"mat_inv", bn_mat_inv,
"mat_trn", bn_mat_trn,
"matXvec", bn_matXvec,
"mat4x3vec", bn_mat4x3vec,
"mat4x3pnt", bn_mat4x3pnt,
"hdivide", bn_hdivide,
"vjoin1", bn_vjoin1,
"mat_ae", bn_mat_ae,
"mat_ae_vec", bn_ae_vec,
"mat_aet_vec", bn_aet_vec,
"mat_angles", bn_mat_angles,
"mat_eigen2x2", bn_eigen2x2,
"mat_fromto", bn_mat_fromto,
"mat_xrot", bn_mat_xrot,
"mat_yrot", bn_mat_yrot,
"mat_zrot", bn_mat_zrot,
"mat_lookat", bn_mat_lookat,
"mat_vec_ortho", bn_vec_ortho,
"mat_vec_perp", bn_vec_perp,
"mat_scale_about_pt", bn_mat_scale_about_pt_wrapper,
"mat_xform_about_pt", bn_mat_xform_about_pt,
"mat_arb_rot", bn_mat_arb_rot,
"quat_mat2quat", quat_mat2quat,
"quat_quat2mat", quat_quat2mat,
"quat_distance", bn_quat_distance_wrapper,
"quat_double", quat_double,
"quat_bisect", quat_bisect,
"quat_slerp", quat_slerp,
"quat_sberp", quat_sberp,
"quat_make_nearest", quat_make_nearest,
"quat_exp", quat_exp,
"quat_log", quat_log,
0, 0
};
/*
* B N _ M A T H _ C M D _ I N T
*
* Tcl wrappers for the math functions of type int.
*
* This is where you should put clauses, in the below "if" statement, to add
* Tcl support for the LIBBN math routines.
*/
int
bn_math_cmd_int(clientData, interp, argc, argv)
ClientData clientData;
Tcl_Interp *interp;
int argc;
char **argv;
{
int (*math_func)();
struct bu_vls result;
math_func = (int (*)())clientData; /* object-to-function cast */
bu_vls_init(&result);
if (math_func == bn_isect_2planes ) {
plane_t a, b;
point_t rpp_min;
struct bn_tol tol;
point_t out_pt;
vect_t out_dir;
int ret;
if( argc != 5 ||
bn_decode_plane(a, argv[1]) < 4 ||
bn_decode_plane(b, argv[2]) < 4 ||
bn_decode_vect(rpp_min, argv[3]) < 3 ||
bn_decode_tol(&tol, argv[4]) < 2
) {
bu_vls_printf(&result, "usage: %s plane_a plane_b rpp_min tol\n", argv[0]);
goto error;
}
if( (ret = bn_isect_2planes( out_pt, out_dir, a, b, rpp_min, &tol )) < 0 ) {
bu_vls_printf(&result, "bn_isect_2planes() failed, ret=%d\n", ret);
goto error;
}
bn_encode_vect( &result, out_pt );
bn_encode_vect( &result, out_dir );
} else {
bu_vls_printf(&result, "libbn/bn_tcl.c: math function %s not supported yet", argv[0]);
goto error;
}
Tcl_AppendResult(interp, bu_vls_addr(&result), (char *)NULL);
bu_vls_free(&result);
return TCL_OK;
error:
Tcl_AppendResult(interp, bu_vls_addr(&result), (char *)NULL);
bu_vls_free(&result);
return TCL_ERROR;
}
static struct math_func_link_int {
char *name;
int (*func)();
} math_funcs_int[] = {
{"bn_isect_2planes", bn_isect_2planes},
{0, 0}
};
/*
* B N _ C M D _ C O M M O N _ F I L E _ S I Z E
*/
@@ -910,18 +793,11 @@ void
bn_tcl_setup(interp)
Tcl_Interp *interp;
{
struct math_func_link_void *vp;
struct math_func_link_int *ip;
struct math_func_link *mp;
for (vp = math_funcs_void; vp->name != NULL; vp++) {
(void)Tcl_CreateCommand(interp, vp->name, bn_math_cmd_void,
(ClientData)vp->func, /* Function-to-Object pointer cast */
(Tcl_CmdDeleteProc *)NULL);
}
for (ip = math_funcs_int; ip->name != NULL; ip++) {
(void)Tcl_CreateCommand(interp, ip->name, bn_math_cmd_int,
(ClientData)ip->func, /* Function-to-Object pointer cast */
for (mp = math_funcs; mp->name != NULL; mp++) {
(void)Tcl_CreateCommand(interp, mp->name, bn_math_cmd,
(ClientData)mp->func, /* Function-to-Object pointer cast */
(Tcl_CmdDeleteProc *)NULL);
}
+1 -1
View File
@@ -19,7 +19,7 @@
* All rights reserved.
*/
#ifndef lint
static const char RCScomplex[] = "@(#)$Header$ (BRL)";
static char RCScomplex[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
+1 -1
View File
@@ -13,7 +13,7 @@
* All rights reserved.
*/
#ifndef lint
static const char RCSmat[] = "@(#)$Header$ (BRL)";
static char RCSmat[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
+8 -10
View File
@@ -53,7 +53,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char bn_RCSmat[] = "@(#)$Header$ (ARL)";
static char bn_RCSmat[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -61,12 +61,6 @@ static const char bn_RCSmat[] = "@(#)$Header$ (ARL)";
#include <stdio.h>
#include <math.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "bu.h"
#include "vmath.h"
@@ -328,10 +322,10 @@ CONST mat_t input;
LOCAL int z[4]; /* Temporary */
LOCAL fastf_t b[4]; /* Temporary */
LOCAL fastf_t c[4]; /* Temporary */
bn_mat_copy( output, input ); /* Duplicate */
/* Initialization */
/* Initialization */
for( j = 0; j < 4; j++ )
z[j] = j;
@@ -1190,7 +1184,11 @@ int
bn_mat_is_identity( m )
CONST mat_t m;
{
return (! memcmp(m, bn_mat_identity, sizeof(mat_t)));
if( m[0] != 1 || m[1] != 0 || m[2] != 0 || m[3] != 0 ) return 0;
if( m[4] != 0 || m[5] != 1 || m[6] != 0 || m[7] != 0 ) return 0;
if( m[8] != 0 || m[9] != 0 || m[10] != 1 || m[11] != 0 ) return 0;
if( m[12] != 0 || m[13] != 0 || m[14] != 0 || m[15] != 1 ) return 0;
return 1;
}
/* B N _ M A T _ A R B _ R O T
+1 -1
View File
@@ -25,7 +25,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char RCSid[] = "@(#)$Header$ (ARL)";
static char RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
+3 -3
View File
@@ -27,7 +27,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSid[] = "@(#)$Header$ (ARL)";
static char RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -758,7 +758,7 @@ double offset;
struct fbm_spec *ep;
double result, weight, signal, *spec_wgts;
point_t pt;
int i;
int i, oct;
/* The first order of business is to see if we have pre-computed
* the spectral weights table for these parameters in a previous
@@ -825,7 +825,7 @@ double offset;
struct fbm_spec *ep;
double result, weight, signal, *spec_wgts;
point_t pt;
int i;
int i, oct;
/* The first order of business is to see if we have pre-computed
* the spectral weights table for these parameters in a previous
+26 -12
View File
@@ -2615,51 +2615,65 @@ min = (%g, %g, %g), max = (%g, %g, %g), half_eqn = (%d, %d, %d, %d)\n",
*/
int
bn_distsq_line3_line3( dist, P, d, Q, e, pt1, pt2 )
bn_distsq_line3_line3( dist, P, d_in, Q, e_in, pt1, pt2 )
fastf_t dist[3];
point_t P;
vect_t d;
vect_t d_in;
point_t Q;
vect_t e;
vect_t e_in;
point_t pt1, pt2;
{
fastf_t de, dd, ee, Qe, Pe, denom;
fastf_t de, Qe, Pe, denom;
vect_t diff, PmQ, tmp;
vect_t d, e;
fastf_t len_e, inv_len_e, len_d, inv_len_d;
int ret=0;
len_e = MAGNITUDE( e_in );
if( NEAR_ZERO( len_e, SMALL_FASTF ) )
bu_bomb( "bn_distsq_line3_line3() called with zero length vector!!!\n");
inv_len_e = 1.0 / len_e;
len_d = MAGNITUDE( d_in );
if( NEAR_ZERO( len_d, SMALL_FASTF ) )
bu_bomb( "bn_distsq_line3_line3() called with zero length vector!!!\n");
inv_len_d = 1.0 / len_d;
VSCALE( e, e_in, inv_len_e );
VSCALE( d, d_in, inv_len_d );
de = VDOT( d, e );
if( NEAR_ZERO( de, SMALL_FASTF ) )
{
/* lines are perpendicular */
dist[0] = (VDOT( Q, d ) - VDOT( P, d ))/VDOT( d, d );
dist[1] = (VDOT( P, e ) - VDOT( Q, e ))/VDOT( e, e );
dist[0] = VDOT( Q, d ) - VDOT( P, d );
dist[1] = VDOT( P, e ) - VDOT( Q, e );
}
else
{
dd = VDOT( d, d );
ee = VDOT( e, e );
VSUB2( PmQ, P, Q );
denom = dd*ee - de*de;
denom = 1.0 - de*de;
if( NEAR_ZERO( denom, SMALL_FASTF ) )
{
/* lines are parallel */
dist[0] = 0.0;
dist[1] = VDOT( PmQ, d ) / VDOT( d, e );
dist[1] = VDOT( PmQ, d );
ret = 1;
}
else
{
VBLEND2( tmp, dd, e, -de, d );
VBLEND2( tmp, 1.0, e, -de, d );
dist[1] = VDOT( PmQ, tmp )/denom;
Qe = VDOT( Q, e );
Pe = VDOT( P, e );
dist[0] = (dist[1] * ee + (Qe - Pe))/de;
dist[0] = dist[1] * de - VDOT( PmQ, d );
}
}
VJOIN1( pt1, P, dist[0], d );
VJOIN1( pt2, Q, dist[1], e );
VSUB2( diff, pt1, pt2 );
dist[0] *= inv_len_d;
dist[1] *= inv_len_e;
dist[2] = MAGSQ( diff );
return( ret );
}
+2 -2
View File
@@ -20,8 +20,8 @@
rb_free rb_insert rb_order_stats \
rb_rotate rb_search rb_walk \
vfont brlcad_path xdr \
vls htond htonf units bu_tcl color cmd \
cmdhist cmdhist_obj observer avs
vls htond units bu_tcl color cmd \
cmdhist cmdhist_obj observer
#define VERSION_VARIABLE bu_version
#define LIBRARY_TITLE "The BRL-CAD Utility Library"
+1 -4
View File
@@ -18,16 +18,13 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_association_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_association_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
#include <stdio.h>
#include <math.h>
#if HAVE_STRING_H
#include <string.h>
#endif
#include "machine.h"
#include "externs.h"
#include "bu.h"
-223
View File
@@ -1,223 +0,0 @@
/*
* A V S . C
*
* Routines to manage attribute/value sets.
*
* Author -
* Michael John Muuss
*
* Source -
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5068 USA
*
* Distribution Status -
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
#include <stdio.h>
#ifdef USE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "bu.h"
/*
* B U _ A V S _ I N I T
*/
void
bu_avs_init( avp, len, str )
struct bu_attribute_value_set *avp;
int len;
CONST char *str;
{
if (bu_debug & BU_DEBUG_AVS)
bu_log("bu_avs_init(%8x, len=%d, %s)\n", avp, len, str);
avp->magic = BU_AVS_MAGIC;
if( len <= 0 ) len = 32;
avp->count = 0;
avp->max = len;
avp->avp = (struct bu_attribute_value_pair *)bu_calloc(avp->max,
sizeof(struct bu_attribute_value_pair), str);
avp->readonly_min = avp->readonly_max = NULL;
}
/*
* B U _ A V S _ N E W
*
* Allocate storage for a new attribute/value set, with at least
* 'len' slots pre-allocated.
*/
struct bu_attribute_value_set *
bu_avs_new( len, str )
int len;
CONST char *str;
{
struct bu_attribute_value_set *avp;
BU_GETSTRUCT( avp, bu_attribute_value_set );
bu_avs_init( avp, len, "bu_avs_new" );
if (bu_debug & BU_DEBUG_AVS)
bu_log("bu_avs_new(len=%d, %s) = x%x\n", len, str, avp);
return avp;
}
/*
* B U _ A V S _ A D D
*
* If the given attribute exists it will recieve the new value,
* othwise the set will be extended to have a new attribute/value pair.
*
* Returns -
* 1 existing attribute updated with new value
* 2 set extended with new attribute/value pair
*/
int
bu_avs_add( avp, attribute, value )
struct bu_attribute_value_set *avp;
CONST char *attribute;
CONST char *value;
{
struct bu_attribute_value_pair *app;
BU_CK_AVS(avp);
for( BU_AVS_FOR(app, avp) ) {
if( strcmp( app->name, attribute ) != 0 ) continue;
if( app->value < avp->readonly_min || app->value > avp->readonly_max )
bu_free( (genptr_t)app->value, "app->value" );
app->value = bu_strdup( value );
return 1;
}
if( avp->count >= avp->max ) {
/* Allocate more space first */
avp->max *= 4;
avp->avp = (struct bu_attribute_value_pair *)bu_realloc(
avp->avp,
avp->max *
sizeof(struct bu_attribute_value_pair),
"attribute_value_pair.avp[] (add)" );
}
app = &avp->avp[avp->count++];
app->name = bu_strdup(attribute);
app->value = bu_strdup(value);
return 2;
}
/*
* B U _ A V S _ A D D _ V L S
*/
int
bu_avs_add_vls( avp, attribute, value_vls )
struct bu_attribute_value_set *avp;
const char *attribute;
const struct bu_vls *value_vls;
{
BU_CK_AVS(avp);
BU_CK_VLS(value_vls);
return bu_avs_add( avp, attribute, bu_vls_addr(value_vls) );
}
/*
* B U _ A V S _ G E T
*/
const char *
bu_avs_get( const struct bu_attribute_value_set *avp, const char *attribute )
{
struct bu_attribute_value_pair *app;
BU_CK_AVS(avp);
for( BU_AVS_FOR(app, avp) ) {
if( strcmp( app->name, attribute ) != 0 ) continue;
return app->value;
}
return NULL;
}
/*
* B U _ A V S _ R E M O V E
*
* Returns -
* -1 attribute not found in set
* 0 OK
*/
int
bu_avs_remove( avp, attribute )
struct bu_attribute_value_set *avp;
CONST char *attribute;
{
struct bu_attribute_value_pair *app, *epp;
BU_CK_AVS(avp);
for( BU_AVS_FOR(app, avp) ) {
if( strcmp( app->name, attribute ) != 0 ) continue;
if( app->name < avp->readonly_min || app->name > avp->readonly_max )
bu_free( (genptr_t)app->name, "app->name" );
if( app->value < avp->readonly_min || app->value > avp->readonly_max )
bu_free( (genptr_t)app->value, "app->value" );
/* Move last one down to fit */
epp = &avp->avp[avp->count--];
if( app != epp ) {
*app = *epp; /* struct copy */
}
epp->name = 0; /* sanity */
epp->value = 0;
return 0;
}
return -1;
}
/*
* B U _ A V S _ F R E E
*/
void
bu_avs_free( struct bu_attribute_value_set *avp )
{
struct bu_attribute_value_pair *app;
BU_CK_AVS(avp);
for( BU_AVS_FOR(app, avp) ) {
if( app->name < avp->readonly_min || app->name > avp->readonly_max )
bu_free( (genptr_t)app->name, "app->name" );
if( app->value < avp->readonly_min || app->value > avp->readonly_max )
bu_free( (genptr_t)app->value, "app->value" );
}
bu_free( (genptr_t)avp->avp, "avp->avp" );
avp->magic = -1L;
}
/*
* B U _ A V S _ P R I N T
*/
void
bu_avs_print( const struct bu_attribute_value_set *avp, const char *title )
{
struct bu_attribute_value_pair *avpp;
int i;
BU_CK_AVS(avp);
bu_log("bu_avs_print: %s\n", title);
avpp = avp->avp;
for( i = 0; i < avp->count; i++, avpp++ ) {
bu_log(" %s = %s\n", avpp->name, avpp->value );
}
}
+1 -1
View File
@@ -16,7 +16,7 @@
* Public Domain, Distribution Unlimitied.
*/
#ifndef lint
static const char RCSbadmagic[] = "@(#)$Header$ (ARL)";
static char RCSbadmagic[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
+1 -2
View File
@@ -21,7 +21,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_bitv_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_bitv_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -31,7 +31,6 @@ static const char libbu_bitv_RCSid[] = "@(#)$Header$ (ARL)";
#else
#include <strings.h>
#endif
#include <ctype.h>
#include "machine.h"
#include "externs.h"
#include "bu.h"
+1 -1
View File
@@ -18,7 +18,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSbomb[] = "@(#)$Header$ (ARL)";
static char RCSbomb[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
+1 -1
View File
@@ -14,7 +14,7 @@
* Distribution Status -
* Public Domain, Distribution Unlimitied.
*/
static const char RCSbrlcad_path[] = "@(#)$Header$ (BRL)";
static char RCSbrlcad_path[] = "@(#)$Header$ (BRL)";
#include "conf.h"
+24 -45
View File
@@ -23,7 +23,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_bu_tcl_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_bu_tcl_RCSid[] = "@(#)$Header$ (ARL)";
#endif
@@ -36,7 +36,6 @@ static const char libbu_bu_tcl_RCSid[] = "@(#)$Header$ (ARL)";
#else
#include <strings.h>
#endif
#include <ctype.h>
#include "tcl.h"
@@ -150,8 +149,7 @@ char *base; /* base addr of users struct */
{
register char *cp, *loc;
register CONST struct bu_structparse *sdp;
register int j;
register int ii;
register int i, j;
struct bu_vls str;
if( desc == (struct bu_structparse *)NULL ) {
@@ -207,12 +205,12 @@ char *base; /* base addr of users struct */
bu_vls_free( &str );
return TCL_ERROR;
}
for( ii = j = 0;
j < sdp->sp_count && argv[0][ii] != '\0';
loc[j++] = argv[0][ii++] )
for( i = j = 0;
j < sdp->sp_count && argv[0][i] != '\0';
loc[j++] = argv[0][i++] )
;
if( ii < sdp->sp_count )
loc[ii] = '\0';
if( i < sdp->sp_count )
loc[i] = '\0';
if( sdp->sp_count > 1 ) {
loc[sdp->sp_count-1] = '\0';
Tcl_AppendResult( interp,
@@ -227,13 +225,9 @@ char *base; /* base addr of users struct */
bu_vls_addr(&str),
(char *)NULL );
}
--argc;
++argv;
break;
case 'S': {
struct bu_vls *vls = (struct bu_vls *)loc;
bu_vls_init_if_uninit( vls );
bu_vls_strcpy(vls, *argv);
break;
}
case 'i':
bu_log(
"Error: %%i not implemented. Contact developers.\n" );
@@ -247,12 +241,12 @@ char *base; /* base addr of users struct */
register int tmpi;
register char CONST *cp;
if( argc < 1 ) { /* XXX - when was ii defined */
if( argc < 1 ) {
bu_vls_trunc( &str, 0 );
bu_vls_printf( &str,
"not enough values for \"%s\" argument: should have %d",
"not enough values for \"%s\" argument: should have %d, only %d given",
sdp->sp_name,
sdp->sp_count);
sdp->sp_count, i );
Tcl_AppendResult( interp,
bu_vls_addr(&str),
(char *)NULL );
@@ -271,11 +265,13 @@ char *base; /* base addr of users struct */
Tcl_AppendResult( interp,
bu_vls_addr(&str),
(char *)NULL );
++argv;
--argc;
break;
}
/* Normal case: an integer */
cp = *argv;
for( ii = 0; ii < sdp->sp_count; ++ii ) {
for( i = 0; i < sdp->sp_count; ++i ) {
if( *cp == '\0' ) {
bu_vls_trunc( &str, 0 );
bu_vls_printf( &str,
@@ -323,6 +319,8 @@ char *base; /* base addr of users struct */
argv[0],
sdp->sp_count > 1 ? "}" : "",
" ", (char *)NULL);
--argc;
++argv;
break; }
case 'f': {
int dot_seen;
@@ -349,14 +347,14 @@ char *base; /* base addr of users struct */
(char *)NULL );
cp = *argv;
for( ii = 0; ii < sdp->sp_count; ii++ ) {
for( i = 0; i < sdp->sp_count; i++ ) {
if( *cp == '\0' ) {
bu_vls_trunc( &str, 0 );
bu_vls_printf( &str,
"not enough values for \"%s\" argument: should have %d, only %d given",
sdp->sp_name,
sdp->sp_count,
ii );
i );
Tcl_AppendResult( interp,
bu_vls_addr(&str),
(char *)NULL );
@@ -432,36 +430,17 @@ char *base; /* base addr of users struct */
argv[0],
sdp->sp_count > 1 ? "}" : "",
" ", (char *)NULL );
--argc;
++argv;
break; }
default: {
struct bu_vls vls;
bu_vls_init(&vls);
bu_vls_printf(&vls,
"%s line:%d Parse error, unknown format: '%s' for element \"%s\"",
__FILE__, __LINE__, sdp->sp_fmt,
sdp->sp_name);
Tcl_AppendResult( interp, bu_vls_addr(&vls),
(char *)NULL );
bu_vls_free( &vls );
default:
Tcl_AppendResult( interp, "unknown format",
(char *)NULL );
return TCL_ERROR;
}
}
if( sdp->sp_hook ) {
sdp->sp_hook( sdp, sdp->sp_name, base, *argv);
}
--argc;
++argv;
break;
}
if( sdp->sp_name == NULL ) {
bu_vls_trunc( &str, 0 );
bu_vls_printf( &str, "invalid attribute %s\n", argv[0] );
+11 -13
View File
@@ -43,11 +43,11 @@ static struct bu_cmdhist_obj HeadCmdHistObj; /* head of command history object
static struct bu_cmdtab ch_cmds[] =
{
{"add", bu_cmdhist_add},
{"curr", bu_cmdhist_curr},
{"next", bu_cmdhist_next},
{"prev", bu_cmdhist_prev},
{(char *)NULL, CMD_NULL}
"add", bu_cmdhist_add,
"curr", bu_cmdhist_curr,
"next", bu_cmdhist_next,
"prev", bu_cmdhist_prev,
(char *)NULL, CMD_NULL
};
int
@@ -62,12 +62,12 @@ cho_hist(clientData, interp, argc, argv)
static struct bu_cmdtab cho_cmds[] =
{
{"add", bu_cmdhist_add},
{"curr", bu_cmdhist_curr},
{"history", bu_cmdhist_history},
{"next", bu_cmdhist_next},
{"prev", bu_cmdhist_prev},
{(char *)NULL, CMD_NULL}
"add", bu_cmdhist_add,
"curr", bu_cmdhist_curr,
"history", bu_cmdhist_history,
"next", bu_cmdhist_next,
"prev", bu_cmdhist_prev,
(char *)NULL, CMD_NULL
};
static int
@@ -118,7 +118,6 @@ cho_deleteProc(clientData)
bu_free((genptr_t)chop, "cho_deleteProc: chop");
}
#if 0 /* As far as I can tell, this is not used. CTJ */
/*
* Close a command history object.
*
@@ -148,7 +147,6 @@ cho_close_tcl(clientData, interp, argc, argv)
return TCL_OK;
}
#endif
static struct bu_cmdhist_obj *
cho_open(clientData, interp, name)
+1 -1
View File
@@ -19,7 +19,7 @@
* This software is Copyright (C) 1997 by the United States Army
* in all countries except the USA. All rights reserved.
*/
static const char libbu_color_RCSid[] = "@(#)$Header$ (BRL)";
static char libbu_color_RCSid[] = "@(#)$Header$ (BRL)";
#include "conf.h"
+3 -18
View File
@@ -23,7 +23,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_convert_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_convert_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -39,27 +39,14 @@ static const char libbu_convert_RCSid[] = "@(#)$Header$ (ARL)";
#include "vmath.h"
#include "bu.h"
/*
* Forward declarations.
*/
int bu_cv_w_cookie(genptr_t, int, int, genptr_t, int, int);
int bu_cv_ntohss(SIGNED short *, int, genptr_t, int);
int bu_cv_ntohus(unsigned short *, int, genptr_t, int);
int bu_cv_ntohsl(SIGNED long int *, int, genptr_t, int);
int bu_cv_ntohul(unsigned long int *, int, genptr_t, int);
int bu_cv_htonss(genptr_t, int, SIGNED short *, int);
int bu_cv_htonus(genptr_t, int, unsigned short *, int);
int bu_cv_htonsl(genptr_t, int, long *, int);
int bu_cv_htonul(genptr_t, int, unsigned long *, int);
/*
* Theses should be moved to a header file soon.
*/
#define CV_CHANNEL_MASK 0x00ff
#define CV_HOST_MASK 0x0100
#define CV_SIGNED_MASK 0x0200
#define CV_TYPE_MASK 0x1c00 /* 0001 1100 0000 0000 */
#define CV_CONVERT_MASK 0x6000 /* 0110 0000 0000 0000 */
#define CV_TYPE_MASK 0x1c00
#define CV_CONVERT_MASK 0x6000
#define CV_TYPE_SHIFT 10
#define CV_CONVERT_SHIFT 13
@@ -328,7 +315,6 @@ int cookie;
* outfmt output format
*
*/
int
cv(out, outfmt, size, in, infmt, count)
genptr_t out;
char *outfmt;
@@ -514,7 +500,6 @@ register int cookie;
* fi
* done
*/
int
bu_cv_w_cookie(out, outcookie, size, in, incookie, count)
genptr_t out;
int outcookie;
+1 -1
View File
@@ -13,7 +13,7 @@
* Public Domain, Distribution Unlimitied.
*/
#ifndef lint
static const char libbu_getopt_RCSid[] = "@(#)$Header$ (BRL)";
static char libbu_getopt_RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
+1 -4
View File
@@ -20,16 +20,13 @@
* All rights reserved.
*/
#ifndef lint
static const char RCShist[] = "@(#)$Header$ (BRL)";
static char RCShist[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
#include <stdio.h>
#include <math.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "machine.h"
#include "bu.h"
+7 -7
View File
@@ -41,7 +41,7 @@
* Public Domain, Distribution Unlimited
*/
#ifndef lint
static const char libbu_htond_RCSid[] = "@(#)$Header$ (BRL)";
static char libbu_htond_RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -110,7 +110,7 @@ int count;
*out++ = in[2];
*out++ = in[1];
*out++ = in[0];
in += SIZEOF_NETWORK_DOUBLE;
in += 8;
}
# define HTOND yes2
@@ -414,12 +414,12 @@ int count;
* IEEE format internally, using big-endian order.
* These are the lucky ones.
*/
if( sizeof(double) != SIZEOF_NETWORK_DOUBLE )
bu_bomb("ntohd: sizeof(double) != SIZEOF_NETWORK_DOUBLE\n");
if( sizeof(double) != 8 )
fprintf(stderr, "ntohd: sizeof(double) != 8\n");
# if BSD
bcopy( in, out, count*SIZEOF_NETWORK_DOUBLE );
bcopy( in, out, count*8 );
# else
memcpy( out, in, count*SIZEOF_NETWORK_DOUBLE );
memcpy( out, in, count*8 );
# endif
return;
# define NTOHD yes1
@@ -436,7 +436,7 @@ int count;
*out++ = in[2];
*out++ = in[1];
*out++ = in[0];
in += SIZEOF_NETWORK_DOUBLE;
in += 8;
}
# define NTOHD yes2
#endif
-111
View File
@@ -1,111 +0,0 @@
/*
* H T O N F . C
*
* Author -
* Michael John Muuss
*
* Source -
* SECAD/VLD Computing Consortium, Bldg 394
* The U. S. Army Ballistic Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5066
*
* Release Status -
* Public Domain, Distribution Unlimited
*/
#ifndef lint
static const char libbu_htond_RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
#include <stdio.h>
#include "machine.h"
#include "bu.h"
#include <stdio.h>
/*
* H T O N F
*
* Host to Network Floats
*/
void
htonf( out, in, count )
register unsigned char *out;
register CONST unsigned char *in;
int count;
{
#if defined(NATURAL_IEEE)
/*
* First, the case where the system already operates in
* IEEE format internally, using big-endian order.
* These are the lucky ones.
*/
# if BSD
bcopy( in, out, count*SIZEOF_NETWORK_FLOAT );
# else
memcpy( out, in, count*SIZEOF_NETWORK_FLOAT );
# endif
return;
# define HTONF yes1
#endif
#if defined(REVERSED_IEEE)
/* This machine uses IEEE, but in little-endian byte order */
register int i;
for( i=count-1; i >= 0; i-- ) {
*out++ = in[3];
*out++ = in[2];
*out++ = in[1];
*out++ = in[0];
in += SIZEOF_NETWORK_FLOAT;
}
# define HTONF yes2
#endif
/* Now, for the machine-specific stuff. */
bu_bomb("htonf() not yet supported on this architecture\n");
}
/*
* N T O H F
*
* Network to Host Floats
*/
void
ntohf( out, in, count )
register unsigned char *out;
register CONST unsigned char *in;
int count;
{
#ifdef NATURAL_IEEE
/*
* First, the case where the system already operates in
* IEEE format internally, using big-endian order.
* These are the lucky ones.
*/
if( sizeof(float) != SIZEOF_NETWORK_FLOAT )
bu_bomb("ntohf: sizeof(float) != SIZEOF_NETWORK_FLOAT\n");
# if BSD
bcopy( in, out, count*SIZEOF_NETWORK_FLOAT );
# else
memcpy( out, in, count*SIZEOF_NETWORK_FLOAT );
# endif
return;
# define NTOHD yes1
#endif
#if defined(REVERSED_IEEE)
/* This machine uses IEEE, but in little-endian byte order */
register int i;
for( i=count-1; i >= 0; i-- ) {
*out++ = in[3];
*out++ = in[2];
*out++ = in[1];
*out++ = in[0];
in += SIZEOF_NETWORK_FLOAT;
}
# define NTOHD yes2
#endif
bu_bomb("ntohf() not yet supported on this architecture\n");
}
+1 -2
View File
@@ -18,14 +18,13 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSispar[] = "@(#)$Header$ (ARL)";
static char RCSispar[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
#include <stdio.h>
#include <math.h>
#include <signal.h>
#include "machine.h"
#include "externs.h"
#include "bu.h"
+1 -1
View File
@@ -15,7 +15,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_linebuf_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_linebuf_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
+1 -1
View File
@@ -15,7 +15,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_list_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_list_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
+1 -1
View File
@@ -28,7 +28,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSlog[] = "@(#)$Header$ (ARL)";
static char RCSlog[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
+12 -16
View File
@@ -22,7 +22,7 @@
* Public Domain, Distribution Unlimitied.
*/
#ifndef lint
static const char RCSmagic[] = "@(#)$Header$ (BRL)";
static char RCSmagic[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -69,26 +69,22 @@ register long magic;
/*
* bu.h
*/
case BU_LIST_HEAD_MAGIC:
return "bu_list";
case BU_BITV_MAGIC:
return "bu_bitv";
case BU_HIST_MAGIC:
return "bu_hist";
case BU_PTBL_MAGIC:
return "bu_ptbl";
case BU_MAPPED_FILE_MAGIC:
return "bu_mapped_file";
case BU_AVS_MAGIC:
return "bu_attribute_value_set";
case BU_VLS_MAGIC:
return "bu_vls";
case BU_PTBL_MAGIC:
return "bu_ptbl";
case BU_BITV_MAGIC:
return "bu_bitv";
case BU_LIST_HEAD_MAGIC:
return "bu_list";
case BU_HIST_MAGIC:
return "bu_hist";
case BU_MAPPED_FILE_MAGIC:
return "bu_mapped_file";
case BU_EXTERNAL_MAGIC:
return "bu_external";
case BU_COLOR_MAGIC:
return "bu_color";
case BU_RB_TREE_MAGIC:
return "bu_rb_tree";
return "red-black tree";
/*
* bn.h
+2 -2
View File
@@ -27,7 +27,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSmalloc[] = "@(#)$Header$ (ARL)";
static char RCSmalloc[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -260,7 +260,7 @@ register genptr_t ptr;
unsigned int cnt;
CONST char *str;
{
struct memdebug *mp=NULL;
struct memdebug *mp;
char *original_ptr = ptr;
if( bu_debug&BU_DEBUG_MEM_CHECK ) {
+1 -2
View File
@@ -27,7 +27,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_mappedfile_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_mappedfile_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -35,7 +35,6 @@ static const char libbu_mappedfile_RCSid[] = "@(#)$Header$ (ARL)";
#include <stdio.h>
#include <math.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef USE_STRING_H
#include <string.h>
#else
+1 -1
View File
@@ -11,7 +11,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_memset_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_memset_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#if defined(BSD) && (BSD < 43)
+4 -4
View File
@@ -32,10 +32,10 @@ static int bu_observer_detach_tcl();
static int bu_observer_show_tcl();
struct bu_cmdtab bu_observer_cmds[] = {
{"attach", bu_observer_attach_tcl},
{"detach", bu_observer_detach_tcl},
{"show", bu_observer_show_tcl},
{(char *)0, (int (*)())0}
"attach", bu_observer_attach_tcl,
"detach", bu_observer_detach_tcl,
"show", bu_observer_show_tcl,
(char *)0, (int (*)())0
};
/*
+4 -23
View File
@@ -15,7 +15,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSparallel[] = "@(#)$Header$ (ARL)";
static char RCSparallel[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -23,24 +23,10 @@ static const char RCSparallel[] = "@(#)$Header$ (ARL)";
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "externs.h"
#include "bu.h"
#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <signal.h>
#endif
#ifdef CRAY
# include <sys/category.h>
# include <sys/resource.h>
@@ -70,9 +56,6 @@ static const char RCSparallel[] = "@(#)$Header$ (ARL)";
# define SGI_4D 1
# define _SGI_SOURCE 1 /* IRIX 5.0.1 needs this to def M_BLKSZ */
# define _BSD_TYPES 1 /* IRIX 5.0.1 botch in sys/prctl.h */
#if ( IRIX == 6 ) && !defined(IRIX64)
typedef __uint64_t k_sigset_t; /* signal set type */
#endif
# include <sys/types.h>
# include <ulocks.h>
/* ulocks.h #include's <limits.h> and <malloc.h> */
@@ -138,7 +121,8 @@ void
bu_nice_set(newnice)
int newnice;
{
int opri, npri;
int opri, npri, chg;
int bias;
#ifdef BSD
#define PRIO_PROCESS 0 /* From /usr/include/sys/resource.h */
@@ -146,8 +130,6 @@ int newnice;
setpriority( PRIO_PROCESS, 0, newnice );
npri = getpriority( PRIO_PROCESS, 0 );
#else
int bias, chg;
/* " nice adds the value of incr to the nice value of the process" */
/* "The default nice value is 20" */
/* "Upon completion, nice returns the new nice value minus 20" */
@@ -393,7 +375,6 @@ bu_set_realtime()
# define CHECK_PIDS 1
#endif
#if defined(PARALLEL)
/*
* B U _ W O R K E R _ T B L _ N O T _ E M P T Y
*/
@@ -428,6 +409,7 @@ int tbl[MAX_PSW];
bzero( (char *)tbl, sizeof(tbl) );
}
extern int bu_pid_of_initiating_thread; /* From ispar.c */
static int bu_nthreads_started = 0; /* # threads started */
@@ -483,7 +465,6 @@ bu_parallel_interface()
if(cpu) _exit(0);
# endif /* SGI */
}
#endif /* PARALLEL */
#ifdef SGI_4D
/*
+6 -49
View File
@@ -29,7 +29,7 @@
* All rights reserved.
*/
#ifndef lint
static const char RCSparse[] = "@(#)$Header$ (BRL)";
static char RCSparse[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -1837,9 +1837,6 @@ char *params;
return( 0 );
}
/*
* B U _ S H A D E R _ T O _ K E Y _ E Q
*/
int
bu_shader_to_key_eq( in, vls )
char *in;
@@ -1940,7 +1937,9 @@ struct bu_vls *vls;
* 0 OK
*/
int
bu_fwrite_external( FILE *fp, const struct bu_external *ep )
bu_fwrite_external( fp, ep )
FILE *fp;
CONST struct bu_external *ep;
{
BU_CK_EXTERNAL(ep);
@@ -1949,54 +1948,12 @@ bu_fwrite_external( FILE *fp, const struct bu_external *ep )
return 0;
}
/*
* B U _ H E X D U M P _ E X T E R N A L
*/
void
bu_hexdump_external( FILE *fp, CONST struct bu_external *ep, CONST char *str)
{
const unsigned char *cp;
const unsigned char *endp;
int i, j, k;
BU_CK_EXTERNAL(ep);
fprintf(fp, "%s:\n", str);
if( ep->ext_nbytes <= 0 ) fprintf(fp, "\tWarning: 0 length external buffer\n");
cp = ep->ext_buf;
endp = cp + ep->ext_nbytes;
for( i=0; i < ep->ext_nbytes; i += 16 ) {
const unsigned char *sp = cp;
for( j=0; j < 4; j++ ) {
for( k=0; k < 4; k++ ) {
if( cp >= endp )
fprintf(fp, " ");
else
fprintf(fp, "%2.2x ", *cp++ );
}
fprintf(fp, " ");
}
fprintf(fp, " |");
for( j=0; j < 16; j++,sp++ ) {
if( sp >= endp ) break;
if( isprint(*sp) )
putc(*sp, fp);
else
putc('.', fp);
}
fprintf(fp, "|\n");
}
}
/*
* B U _ F R E E _ E X T E R N A L
*/
void
bu_free_external( register struct bu_external *ep)
bu_free_external( ep )
register struct bu_external *ep;
{
BU_CK_EXTERNAL(ep);
if( ep->ext_buf ) {
+2 -2
View File
@@ -12,7 +12,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_printb_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_printb_RCSid[] = "@(#)$Header$ (ARL)";
#endif
@@ -55,7 +55,7 @@ register CONST char *bits;
bu_vls_printf( vls, "%s=0%o <", s, v);
else
bu_vls_printf( vls, "%s=x%x <", s, v);
while ((i = *bits++)) {
while (i = *bits++) {
if (v & (1L << (i-1))) {
if (any)
bu_vls_strcat( vls, ",");
+1 -6
View File
@@ -21,18 +21,13 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_ptbl_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_ptbl_RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
#include <stdio.h>
#include "machine.h"
#include "bu.h"
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
/*
* B U _ P T B L _ I N I T
+1 -1
View File
@@ -20,7 +20,7 @@
*
*/
#ifndef lint
static const char libbu_rb_create_RCSid[] = "@(#) $Header$";
static char libbu_rb_create_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static char const libbu_rb_delete_RCSid[] = "@(#) $Header$";
static char libbu_rb_delete_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_diag_RCSid[] = "@(#) $Header$";
static char libbu_rb_diag_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -20,7 +20,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_extreme_RCSid[] = "@(#) $Header$";
static char libbu_rb_extreme_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_free_RCSid[] = "@(#) $Header$";
static char libbu_rb_free_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+2 -2
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_insert_RCSid[] = "@(#) $Header$";
static char libbu_rb_insert_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
@@ -51,7 +51,7 @@ struct bu_rb_node *new_node;
struct bu_rb_node *grand_parent;
struct bu_rb_node *y;
int (*compare)();
int comparison=0xdeadbeef;
int comparison;
int direction;
int result = 0;
+1 -1
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_order_stats_RCSid[] = "@(#) $Header$";
static char libbu_rb_order_stats_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_rotate_RCSid[] = "@(#) $Header$";
static char libbu_rb_rotate_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -19,7 +19,7 @@
* in all countries except the USA. All rights reserved.
*/
#ifndef lint
static const char libbu_rb_search_RCSid[] = "@(#) $Header$";
static char libbu_rb_search_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+1 -1
View File
@@ -38,7 +38,7 @@
* depth in the tree.
*/
#ifndef lint
static const char libbu_rb_walk_RCSid[] = "@(#) $Header$";
static char libbu_rb_walk_RCSid[] = "@(#) $Header$";
#endif
#include "conf.h"
+3 -8
View File
@@ -24,7 +24,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSsemaphore[] = "@(#)$Header$ (ARL)";
static char RCSsemaphore[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
@@ -69,9 +69,6 @@ struct bu_semaphores {
# define SGI_4D 1
# define _SGI_SOURCE 1 /* IRIX 5.0.1 needs this to def M_BLKSZ */
# define _BSD_TYPES 1 /* IRIX 5.0.1 botch in sys/prctl.h */
#if ( IRIX == 6 ) && !defined(IRIX64)
typedef __uint64_t k_sigset_t; /* signal set type */
#endif
# include <sys/types.h>
# include <ulocks.h>
/* ulocks.h #include's <limits.h> and <malloc.h> */
@@ -211,10 +208,8 @@ register long *p;
}
#endif /* convex */
#if defined(PARALLEL) || defined(DEFINED_BU_SEMAPHORES)
static unsigned int bu_nsemaphores = 0;
static struct bu_semaphores *bu_semaphores = (struct bu_semaphores *)NULL;
#endif
/*
* B U _ S E M A P H O R E _ I N I T
@@ -230,11 +225,11 @@ void
bu_semaphore_init( nsemaphores )
unsigned int nsemaphores;
{
int i;
#if !defined(PARALLEL) && !defined(DEFINED_BU_SEMAPHORES)
return; /* No support on this hardware */
#else
int i;
if( bu_nsemaphores != 0 ) return; /* Already called */
bu_semaphores = (struct bu_semaphores *)calloc(
nsemaphores,
+38 -44
View File
@@ -16,7 +16,7 @@
* All rights reserved.
*/
#ifndef lint
static const char libbu_units_RCSid[] = "@(#)$Header$ (BRL)";
static char libbu_units_RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -24,12 +24,6 @@ static const char libbu_units_RCSid[] = "@(#)$Header$ (BRL)";
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "externs.h" /* needed for things like strtod() */
#include "bu.h"
@@ -38,43 +32,43 @@ static CONST struct cvt_tab {
double val;
char name[32];
} bu_units_tab[] = {
{0.0, "none"},
{1.0e-7, "angstrom"},
{1.0e-7, "decinanometer"},
{1.0e-6, "nm"},
{1.0e-6, "nanometer"},
{1.0e-3, "um"},
{1.0e-3, "micrometer"},
{1.0e-3, "micron"},
{1.0, "mm"},
{1.0, "millimeter"},
{10.0, "cm"},
{10.0, "centimeter"},
{1000.0, "m"},
{1000.0, "meter"},
{1000000.0, "km"},
{1000000.0, "kilometer"},
{25.4, "in"},
{25.4, "inch"},
{25.4, "inche"}, /* for plural */
{304.8, "ft"},
{304.8, "foot"},
{304.8, "feet"},
{456.2, "cubit"},
{914.4, "yd"},
{914.4, "yard"},
{5029.2, "rd"},
{5029.2, "rod"},
{1609344.0, "mi"},
{1609344.0, "mile"},
{1852000.0, "nmile"},
{1852000.0, "nautical mile"},
{1.495979e+14, "AU"},
{1.495979e+14, "astronomical unit"},
{9.460730e+18, "lightyear"},
{3.085678e+19, "pc"},
{3.085678e+19, "parsec"},
{0.0, ""} /* LAST ENTRY */
0.0, "none",
1.0e-7, "angstrom",
1.0e-7, "decinanometer",
1.0e-6, "nm",
1.0e-6, "nanometer",
1.0e-3, "um",
1.0e-3, "micrometer",
1.0e-3, "micron",
1.0, "mm",
1.0, "millimeter",
10.0, "cm",
10.0, "centimeter",
1000.0, "m",
1000.0, "meter",
1000000.0, "km",
1000000.0, "kilometer",
25.4, "in",
25.4, "inch",
25.4, "inche", /* for plural */
304.8, "ft",
304.8, "foot",
304.8, "feet",
456.2, "cubit",
914.4, "yd",
914.4, "yard",
5029.2, "rd",
5029.2, "rod",
1609344.0, "mi",
1609344.0, "mile",
1852000.0, "nmile",
1852000.0, "nautical mile",
1.495979e+14, "AU",
1.495979e+14, "astronomical unit",
9.460730e+18, "lightyear",
3.085678e+19, "pc",
3.085678e+19, "parsec",
0.0, "" /* LAST ENTRY */
};
#define BU_UNITS_TABLE_SIZE (sizeof(bu_units_tab) / sizeof(struct cvt_tab) - 1)
+1 -7
View File
@@ -19,7 +19,7 @@
* Public Domain, Distribution Unlimited
*/
#ifndef lint
static const char libbu_vfont_RCSid[] = "@(#)$Header$ (BRL)";
static char libbu_vfont_RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -28,17 +28,11 @@ static const char libbu_vfont_RCSid[] = "@(#)$Header$ (BRL)";
#include "machine.h"
#include "externs.h"
#include "vfont-if.h"
#include "bu.h"
#define FONTDIR2 "/usr/lib/vfont"
#define DEFAULT_FONT "nonie.r.12"
#define FONTNAMESZ 128
/*
* Forward Definitions
*/
int vax_gshort(char *);
/*
* V F O N T _ G E T
*
+4 -4
View File
@@ -17,7 +17,7 @@
* Distribution Status -
* Public Domain, Distribution Unlimitied.
*/
static const char libbu_vls_RCSid[] = "@(#)$Header$ (BRL)";
static char libbu_vls_RCSid[] = "@(#)$Header$ (BRL)";
#include "conf.h"
@@ -759,7 +759,7 @@ va_list ap;
#define FIELDLEN 0x002
int flags;
int fieldlen=-1;
int fieldlen;
char fbuf[64], buf[1024]; /* % format buffer */
BU_CK_VLS(vls);
@@ -816,7 +816,7 @@ va_list ap;
int stringlen = strlen(str);
int left_justify;
if ((left_justify = (fieldlen < 0)))
if (left_justify = (fieldlen < 0))
fieldlen *= -1;
if (stringlen >= fieldlen)
@@ -859,7 +859,7 @@ va_list ap;
int stringlen = bu_vls_strlen(vp);
int left_justify;
if ((left_justify = (fieldlen < 0)))
if (left_justify = (fieldlen < 0))
fieldlen *= -1;
if (stringlen >= fieldlen)
+1 -1
View File
@@ -16,7 +16,7 @@
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char libbu_xdr_RCSid[] = "@(#)$Header$ (ARL)";
static char libbu_xdr_RCSid[] = "@(#)$Header$ (ARL)";
#endif
+74
View File
@@ -0,0 +1,74 @@
/*
* C M D . C
*
* Utility routines for handling commands.
*
*
* Source -
* SLAD CAD Team
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005
*
* Author -
* Robert G. Parker
*/
#include "conf.h"
#include "tcl.h"
#include "machine.h"
#include "externs.h"
#include "cmd.h"
/*
* Generic command parser.
*/
int
do_cmd(clientData, interp, argc, argv, cmds, cmd_index)
ClientData clientData;
Tcl_Interp *interp;
int argc;
char **argv;
struct cmdtab *cmds;
int cmd_index;
{
register struct cmdtab *ctp;
/* sanity */
if (cmd_index >= argc) {
Tcl_AppendResult(interp,
"missing command; must be one of:",
(char *)NULL);
goto missing_cmd;
}
for (ctp = cmds; ctp->ct_name != (char *)NULL; ctp++) {
if (strcmp(ctp->ct_name, argv[cmd_index]) == 0) {
return (*ctp->ct_func)(clientData, interp, argc, argv);
}
}
Tcl_AppendResult(interp,
"unknown command; must be one of:",
(char *)NULL);
missing_cmd:
for (ctp = cmds; ctp->ct_name != (char *)NULL; ctp++) {
Tcl_AppendResult(interp, " ", ctp->ct_name, (char *)NULL);
}
Tcl_AppendResult(interp, "\n", (char *)NULL);
return TCL_ERROR;
}
/*
* Generic routine to register commands with a Tcl interpreter.
*/
void
register_cmds(interp, cmds)
Tcl_Interp *interp;
struct cmdtab *cmds;
{
register struct cmdtab *ctp;
for (ctp = cmds; ctp->ct_name != (char *)NULL; ctp++)
(void)Tcl_CreateCommand(interp, ctp->ct_name, ctp->ct_func,
(ClientData)ctp, (Tcl_CmdDeleteProc *)NULL);
}
+9 -9
View File
@@ -10,7 +10,6 @@
#include "dm.h"
#include "dm-Null.h"
static void Nu_input();
void Nu_void();
int Nu_int0();
struct dm *Nu_open();
@@ -54,18 +53,19 @@ struct dm dm_Null = {
0,
0,
{0, 0},
0,
0,
0,
0,
0,
0, /* clipmin */
0, /* clipmax */
{0, 0, 0, 0, 0}, /* bu_vls path name*/
{0, 0, 0, 0, 0}, /* bu_vls full name drawing window */
{0, 0, 0, 0, 0}, /* bu_vls short name drawing window */
{0, 0, 0}, /* bg color */
{0, 0, 0}, /* fg color */
{0.0, 0.0, 0.0}, /* clipmin */
{0.0, 0.0, 0.0}, /* clipmax */
0, /* no debugging */
0, /* no perspective */
0, /* no lighting */
0, /* no zbuffer */
0 /* no zclipping */
0, /* no zclipping */
0 /* Tcl interpreter */
};
int Nu_int0() { return TCL_OK; }
+253 -238
View File
@@ -17,7 +17,7 @@
* All rights reserved.
*/
#ifndef lint
static char RCSid[] = "@(#)$Header$ (BRL)";
static const char RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -31,11 +31,15 @@ static char RCSid[] = "@(#)$Header$ (BRL)";
#include "tk.h"
#include <X11/Xutil.h>
#define USE_DIALS_AND_BUTTONS 0
#ifdef HAVE_XOSDEFS_H
#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>
#endif
#if USE_DIALS_AND_BUTTONS
#include <X11/extensions/XInput.h>
#endif
#if defined(linux)
# undef X_NOT_STDC_ENV
# undef X_NOT_POSIX
@@ -116,25 +120,25 @@ struct dm dm_X = {
1.0, /* aspect ratio */
0,
{0, 0},
0,
0,
0,
0,
0,
0, /* clipmin */
0, /* clipmax */
{0, 0, 0, 0, 0}, /* bu_vls path name*/
{0, 0, 0, 0, 0}, /* bu_vls full name drawing window */
{0, 0, 0, 0, 0}, /* bu_vls short name drawing window */
{0, 0, 0}, /* bg color */
{0, 0, 0}, /* fg color */
{0.0, 0.0, 0.0}, /* clipmin */
{0.0, 0.0, 0.0}, /* clipmax */
0, /* no debugging */
0, /* no perspective */
0, /* no lighting */
0, /* no zbuffer */
0 /* no zclipping */
0, /* no zclipping */
0 /* Tcl interpreter */
};
fastf_t min_short = (fastf_t)SHRT_MIN;
fastf_t max_short = (fastf_t)SHRT_MAX;
/* Currently, the application must define these. */
extern Tk_Window tkwin;
extern int vectorThreshold; /* defined in libdm/tcl.c */
/*
* X _ O P E N
@@ -143,29 +147,38 @@ extern Tk_Window tkwin;
*
*/
struct dm *
X_open(argc, argv)
int argc;
char *argv[];
X_open(interp, argc, argv)
Tcl_Interp *interp;
int argc;
char *argv[];
{
static int count = 0;
int j, k;
int make_square = -1;
XGCValues gcv;
#if USE_DIALS_AND_BUTTONS
int j, k;
int ndevices;
int nclass = 0;
XDeviceInfoPtr olist, list;
XDevice *dev;
XEventClass e_class[15];
XInputClassInfo *cip;
#endif
struct bu_vls str;
struct bu_vls init_proc_vls;
struct dm *dmp;
Tk_Window tkwin;
if ((tkwin = Tk_MainWindow(interp)) == NULL) {
return DM_NULL;
}
BU_GETSTRUCT(dmp, dm);
if(dmp == DM_NULL)
return DM_NULL;
*dmp = dm_X; /* struct copy */
dmp->dm_interp = interp;
dmp->dm_vars.pub_vars = (genptr_t)bu_calloc(1, sizeof(struct dm_xvars), "X_open: dm_xvars");
if(dmp->dm_vars.pub_vars == (genptr_t)NULL){
@@ -365,6 +378,7 @@ char *argv[];
goto Skip_dials;
}
#if USE_DIALS_AND_BUTTONS
/*
* Take a look at the available input devices. We're looking
* for "dial+buttons".
@@ -418,6 +432,7 @@ char *argv[];
}
Done:
XFreeDeviceList(olist);
#endif
Skip_dials:
#ifndef CRAY2
@@ -571,233 +586,233 @@ int which_eye;
HIDDEN int
X_drawVList(dmp, vp)
struct dm *dmp;
register struct rt_vlist *vp;
struct dm *dmp;
register struct rt_vlist *vp;
{
static vect_t spnt, lpnt, pnt;
register struct rt_vlist *tvp;
XSegment segbuf[1024]; /* XDrawSegments list */
XSegment *segp; /* current segment */
int nseg; /* number of segments */
fastf_t delta;
register point_t *pt_prev = NULL;
fastf_t dist_prev=1.0;
static vect_t spnt, lpnt, pnt;
register struct rt_vlist *tvp;
XSegment segbuf[1024]; /* XDrawSegments list */
XSegment *segp; /* current segment */
int nseg; /* number of segments */
fastf_t delta;
register point_t *pt_prev = NULL;
fastf_t dist_prev=1.0;
static int nvectors = 0;
if (dmp->dm_debugLevel) {
bu_log("X_drawVList()\n");
bu_log("vp - %lu, perspective - %d\n", vp, dmp->dm_perspective);
}
/* delta is used in clipping to insure clipped endpoint is slightly
* in front of eye plane (perspective mode only).
* This value is a SWAG that seems to work OK.
*/
delta = ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[15]*0.0001;
if( delta < 0.0 )
delta = -delta;
if( delta < SQRT_SMALL_FASTF )
delta = SQRT_SMALL_FASTF;
nseg = 0;
segp = segbuf;
for( BU_LIST_FOR( tvp, rt_vlist, &vp->l ) ) {
register int i;
register int nused = tvp->nused;
register int *cmd = tvp->cmd;
register point_t *pt = tvp->pt;
fastf_t dist;
/* Viewing region is from -1.0 to +1.0 */
/* 2^31 ~= 2e9 -- dynamic range of a long int */
/* 2^(31-11) = 2^20 ~= 1e6 */
/* Integerize and let the X server do the clipping */
for( i = 0; i < nused; i++,cmd++,pt++ ) {
switch( *cmd ) {
case RT_VLIST_POLY_START:
case RT_VLIST_POLY_VERTNORM:
continue;
case RT_VLIST_POLY_MOVE:
case RT_VLIST_LINE_MOVE:
/* Move, not draw */
if(dmp->dm_debugLevel > 2){
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
if (dmp->dm_perspective > 0)
{
/* cannot apply perspective transformation to
* points behind eye plane!!!!
*/
dist = VDOT(*pt, &((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[12]) + ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[15];
if( dist <= 0.0 )
{
pt_prev = pt;
dist_prev = dist;
continue;
}
else
{
MAT4X3PNT(lpnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
dist_prev = dist;
pt_prev = pt;
}
}
else
MAT4X3PNT(lpnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
lpnt[0] *= 2047;
lpnt[1] *= 2047 * dmp->dm_aspect;
lpnt[2] *= 2047;
continue;
case RT_VLIST_POLY_DRAW:
case RT_VLIST_POLY_END:
case RT_VLIST_LINE_DRAW:
/* draw */
if(dmp->dm_debugLevel > 2){
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
if (dmp->dm_perspective > 0)
{
/* cannot apply perspective transformation to
* points behind eye plane!!!!
*/
dist = VDOT( *pt, &((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[12] ) + ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[15];
if(dmp->dm_debugLevel > 2)
bu_log( "dist=%g, dist_prev=%g\n", dist, dist_prev );
if( dist <= 0.0 )
{
if( dist_prev <= 0.0 )
{
/* nothing to plot */
dist_prev = dist;
pt_prev = pt;
continue;
}
else
{
fastf_t alpha;
vect_t diff;
point_t tmp_pt;
/* clip this end */
VSUB2( diff, *pt, *pt_prev );
alpha = (dist_prev - delta) / ( dist_prev - dist );
VJOIN1( tmp_pt, *pt_prev, alpha, diff );
MAT4X3PNT( pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, tmp_pt );
}
}
else
{
if( dist_prev <= 0.0 )
{
fastf_t alpha;
vect_t diff;
point_t tmp_pt;
/* clip other end */
VSUB2( diff, *pt, *pt_prev );
alpha = (-dist_prev + delta) / ( dist - dist_prev );
VJOIN1( tmp_pt, *pt_prev, alpha, diff );
MAT4X3PNT( lpnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, tmp_pt );
lpnt[0] *= 2047;
lpnt[1] *= 2047 * dmp->dm_aspect;
lpnt[2] *= 2047;
MAT4X3PNT( pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt );
}
else
{
MAT4X3PNT( pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt );
}
}
}
else
MAT4X3PNT( pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt );
pnt[0] *= 2047;
pnt[1] *= 2047 * dmp->dm_aspect;
pnt[2] *= 2047;
/* save pnt --- it might get changed by clip() */
VMOVE(spnt, pnt);
pt_prev = pt;
dist_prev = dist;
if(dmp->dm_debugLevel > 2) {
bu_log("before clipping:\n");
bu_log("clipmin - %lf %lf %lf\n",
dmp->dm_clipmin[X],
dmp->dm_clipmin[Y],
dmp->dm_clipmin[Z]);
bu_log("clipmax - %lf %lf %lf\n",
dmp->dm_clipmax[X],
dmp->dm_clipmax[Y],
dmp->dm_clipmax[Z]);
bu_log("pt1 - %lf %lf %lf\n", lpnt[X], lpnt[Y], lpnt[Z]);
bu_log("pt2 - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
}
if (dmp->dm_zclip) {
if(vclip(lpnt, pnt,
dmp->dm_clipmin,
dmp->dm_clipmax) == 0){
VMOVE(lpnt, spnt);
continue;
}
}else{
/* Check to see if lpnt or pnt contain values that exceed
the capacity of a short (segbuf is an array of XSegments which
contain shorts). If so, do clipping now. Otherwise, let the
X server do the clipping */
if(lpnt[0] < min_short || max_short < lpnt[0] ||
lpnt[1] < min_short || max_short < lpnt[1] ||
pnt[0] < min_short || max_short < pnt[0] ||
pnt[1] < min_short || max_short < pnt[1]){
/* if the entire line segment will not be visible then ignore it */
if(clip(&lpnt[0], &lpnt[1], &pnt[0], &pnt[1]) == -1){
VMOVE(lpnt, spnt);
continue;
}
}
}
if(dmp->dm_debugLevel > 2) {
bu_log("after clipping:\n");
bu_log("pt1 - %lf %lf %lf\n", lpnt[X], lpnt[Y], lpnt[Z]);
bu_log("pt2 - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
}
/* convert to X window coordinates */
segp->x1 = (short)GED_TO_Xx(dmp, lpnt[0]);
segp->y1 = (short)GED_TO_Xy(dmp, lpnt[1]);
segp->x2 = (short)GED_TO_Xx(dmp, pnt[0]);
segp->y2 = (short)GED_TO_Xy(dmp, pnt[1]);
nseg++;
segp++;
VMOVE(lpnt, spnt);
if( nseg == 1024 ) {
XDrawSegments( ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
((struct x_vars *)dmp->dm_vars.priv_vars)->gc, segbuf, nseg );
nseg = 0;
segp = segbuf;
}
break;
}
if (dmp->dm_debugLevel) {
bu_log("X_drawVList()\n");
bu_log("vp - %lu, perspective - %d\n", vp, dmp->dm_perspective);
}
}
if( nseg ) {
XDrawSegments( ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
((struct x_vars *)dmp->dm_vars.priv_vars)->gc, segbuf, nseg );
}
return TCL_OK;
/* delta is used in clipping to insure clipped endpoint is slightly
* in front of eye plane (perspective mode only).
* This value is a SWAG that seems to work OK.
*/
delta = ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[15]*0.0001;
if (delta < 0.0)
delta = -delta;
if (delta < SQRT_SMALL_FASTF)
delta = SQRT_SMALL_FASTF;
nseg = 0;
segp = segbuf;
for (BU_LIST_FOR(tvp, rt_vlist, &vp->l)) {
register int i;
register int nused = tvp->nused;
register int *cmd = tvp->cmd;
register point_t *pt = tvp->pt;
fastf_t dist;
/* Viewing region is from -1.0 to +1.0 */
/* 2^31 ~= 2e9 -- dynamic range of a long int */
/* 2^(31-11) = 2^20 ~= 1e6 */
/* Integerize and let the X server do the clipping */
for (i = 0; i < nused; i++,cmd++,pt++) {
switch (*cmd) {
case RT_VLIST_POLY_START:
case RT_VLIST_POLY_VERTNORM:
continue;
case RT_VLIST_POLY_MOVE:
case RT_VLIST_LINE_MOVE:
/* Move, not draw */
if (dmp->dm_debugLevel > 2) {
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
if (dmp->dm_perspective > 0) {
/* cannot apply perspective transformation to
* points behind eye plane!!!!
*/
dist = VDOT(*pt, &((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[12]) + ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[15];
if (dist <= 0.0) {
pt_prev = pt;
dist_prev = dist;
continue;
} else {
MAT4X3PNT(lpnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
dist_prev = dist;
pt_prev = pt;
}
} else {
MAT4X3PNT(lpnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
}
lpnt[0] *= 2047;
lpnt[1] *= 2047 * dmp->dm_aspect;
lpnt[2] *= 2047;
continue;
case RT_VLIST_POLY_DRAW:
case RT_VLIST_POLY_END:
case RT_VLIST_LINE_DRAW:
/* draw */
if (dmp->dm_debugLevel > 2) {
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
if (dmp->dm_perspective > 0) {
/* cannot apply perspective transformation to
* points behind eye plane!!!!
*/
dist = VDOT( *pt, &((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[12] ) + ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat[15];
if (dmp->dm_debugLevel > 2)
bu_log( "dist=%g, dist_prev=%g\n", dist, dist_prev );
if (dist <= 0.0) {
if (dist_prev <= 0.0) {
/* nothing to plot */
dist_prev = dist;
pt_prev = pt;
continue;
} else {
fastf_t alpha;
vect_t diff;
point_t tmp_pt;
/* clip this end */
VSUB2(diff, *pt, *pt_prev);
alpha = (dist_prev - delta) / (dist_prev - dist);
VJOIN1(tmp_pt, *pt_prev, alpha, diff);
MAT4X3PNT(pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, tmp_pt);
}
} else {
if (dist_prev <= 0.0) {
fastf_t alpha;
vect_t diff;
point_t tmp_pt;
/* clip other end */
VSUB2(diff, *pt, *pt_prev);
alpha = (-dist_prev + delta) / (dist - dist_prev);
VJOIN1(tmp_pt, *pt_prev, alpha, diff);
MAT4X3PNT(lpnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, tmp_pt);
lpnt[0] *= 2047;
lpnt[1] *= 2047 * dmp->dm_aspect;
lpnt[2] *= 2047;
MAT4X3PNT(pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
} else {
MAT4X3PNT(pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
}
}
dist_prev = dist;
} else {
MAT4X3PNT(pnt, ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat, *pt);
}
pnt[0] *= 2047;
pnt[1] *= 2047 * dmp->dm_aspect;
pnt[2] *= 2047;
/* save pnt --- it might get changed by clip() */
VMOVE(spnt, pnt);
pt_prev = pt;
if (dmp->dm_debugLevel > 2) {
bu_log("before clipping:\n");
bu_log("clipmin - %lf %lf %lf\n",
dmp->dm_clipmin[X],
dmp->dm_clipmin[Y],
dmp->dm_clipmin[Z]);
bu_log("clipmax - %lf %lf %lf\n",
dmp->dm_clipmax[X],
dmp->dm_clipmax[Y],
dmp->dm_clipmax[Z]);
bu_log("pt1 - %lf %lf %lf\n", lpnt[X], lpnt[Y], lpnt[Z]);
bu_log("pt2 - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
}
if (dmp->dm_zclip) {
if (vclip(lpnt, pnt,
dmp->dm_clipmin,
dmp->dm_clipmax) == 0) {
VMOVE(lpnt, spnt);
continue;
}
} else {
/* Check to see if lpnt or pnt contain values that exceed
the capacity of a short (segbuf is an array of XSegments which
contain shorts). If so, do clipping now. Otherwise, let the
X server do the clipping */
if (lpnt[0] < min_short || max_short < lpnt[0] ||
lpnt[1] < min_short || max_short < lpnt[1] ||
pnt[0] < min_short || max_short < pnt[0] ||
pnt[1] < min_short || max_short < pnt[1]) {
/* if the entire line segment will not be visible then ignore it */
if (clip(&lpnt[0], &lpnt[1], &pnt[0], &pnt[1]) == -1) {
VMOVE(lpnt, spnt);
continue;
}
}
}
if (dmp->dm_debugLevel > 2) {
bu_log("after clipping:\n");
bu_log("pt1 - %lf %lf %lf\n", lpnt[X], lpnt[Y], lpnt[Z]);
bu_log("pt2 - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
}
/* convert to X window coordinates */
segp->x1 = (short)GED_TO_Xx(dmp, lpnt[0]);
segp->y1 = (short)GED_TO_Xy(dmp, lpnt[1]);
segp->x2 = (short)GED_TO_Xx(dmp, pnt[0]);
segp->y2 = (short)GED_TO_Xy(dmp, pnt[1]);
nseg++;
segp++;
VMOVE(lpnt, spnt);
if (nseg == 1024) {
XDrawSegments(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
((struct x_vars *)dmp->dm_vars.priv_vars)->gc, segbuf, nseg);
nseg = 0;
segp = segbuf;
}
break;
}
}
nvectors += nused;
if (nvectors >= vectorThreshold) {
if (dmp->dm_debugLevel)
bu_log("X_drawVList(): handle Tcl events\n");
nvectors = 0;
/* Handle events in the queue */
while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT));
}
}
if (nseg) {
XDrawSegments( ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
((struct x_vars *)dmp->dm_vars.priv_vars)->gc, segbuf, nseg );
}
return TCL_OK;
}
/*
+16 -15
View File
@@ -53,25 +53,26 @@ extern void ogl_fogHint();
#endif
struct dm *
dm_open(type, argc, argv)
int type;
int argc;
char *argv[];
dm_open(interp, type, argc, argv)
Tcl_Interp *interp;
int type;
int argc;
char *argv[];
{
switch(type){
case DM_TYPE_NULL:
return Nu_open(argc, argv);
case DM_TYPE_PLOT:
return plot_open(argc, argv);
case DM_TYPE_PS:
return ps_open(argc, argv);
switch (type) {
case DM_TYPE_NULL:
return Nu_open(argc, argv);
case DM_TYPE_PLOT:
return plot_open(argc, argv);
case DM_TYPE_PS:
return ps_open(argc, argv);
#ifdef DM_X
case DM_TYPE_X:
return X_open(argc, argv);
case DM_TYPE_X:
return X_open(interp, argc, argv);
#endif
#ifdef DM_OGL
case DM_TYPE_OGL:
return ogl_open(argc, argv);
case DM_TYPE_OGL:
return ogl_open(interp, argc, argv);
#endif
default:
break;
+112 -67
View File
@@ -65,8 +65,13 @@
#define YSTEREO 491 /* subfield height, in scanlines */
#define YOFFSET_LEFT 532 /* YSTEREO + YBLANK ? */
extern Tk_Window tkwin;
#define USE_VECTOR_THRESHHOLD 0
#if USE_VECTOR_THRESHHOLD
extern int vectorThreshold; /* defined in libdm/tcl.c */
#endif
static int ogl_actively_drawing;
HIDDEN XVisualInfo *ogl_choose_visual();
/* Display Manager package interface */
@@ -130,18 +135,19 @@ struct dm dm_ogl = {
1.0, /* aspect ratio */
0,
{0, 0},
0,
0,
0,
0,
0,
0, /* clipmin */
0, /* clipmax */
{0, 0, 0, 0, 0}, /* bu_vls path name*/
{0, 0, 0, 0, 0}, /* bu_vls full name drawing window */
{0, 0, 0, 0, 0}, /* bu_vls short name drawing window */
{0, 0, 0}, /* bg color */
{0, 0, 0}, /* fg color */
{0.0, 0.0, 0.0}, /* clipmin */
{0.0, 0.0, 0.0}, /* clipmax */
0, /* no debugging */
0, /* no perspective */
0, /* no lighting */
1, /* no zbuffer */
0 /* no zclipping */
1, /* zbuffer */
0, /* no zclipping */
0 /* Tcl interpreter */
};
HIDDEN fastf_t default_viewscale = 1000.0;
@@ -177,9 +183,10 @@ int fastfog;
*
*/
struct dm *
ogl_open(argc, argv)
int argc;
char *argv[];
ogl_open(interp, argc, argv)
Tcl_Interp *interp;
int argc;
char *argv[];
{
static int count = 0;
GLfloat backgnd[4];
@@ -195,12 +202,18 @@ char *argv[];
struct bu_vls init_proc_vls;
Display *tmp_dpy;
struct dm *dmp;
Tk_Window tkwin;
if((tkwin = Tk_MainWindow(interp)) == NULL){
return DM_NULL;
}
BU_GETSTRUCT(dmp, dm);
if(dmp == DM_NULL)
return DM_NULL;
*dmp = dm_ogl; /* struct copy */
dmp->dm_interp = interp;
dmp->dm_vars.pub_vars = (genptr_t)bu_calloc(1, sizeof(struct dm_xvars), "ogl_open: dm_xvars");
if(dmp->dm_vars.pub_vars == (genptr_t)NULL){
@@ -729,9 +742,15 @@ struct dm *dmp;
{
GLfloat fogdepth;
if (dmp->dm_debugLevel)
if (dmp->dm_debugLevel) {
bu_log("ogl_drawBegin\n");
if (ogl_actively_drawing)
bu_log("ogl_drawBegin: already actively drawing\n");
}
ogl_actively_drawing = 1;
if (!glXMakeCurrent(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
((struct ogl_vars *)dmp->dm_vars.priv_vars)->glxc)){
@@ -804,6 +823,7 @@ struct dm *dmp;
glFinish();
#endif
ogl_actively_drawing = 0;
return TCL_OK;
}
@@ -912,64 +932,89 @@ int which_eye;
*/
HIDDEN int
ogl_drawVList(dmp, vp)
struct dm *dmp;
register struct rt_vlist *vp;
struct dm *dmp;
register struct rt_vlist *vp;
{
register struct rt_vlist *tvp;
int first;
register struct rt_vlist *tvp;
int first;
#if USE_VECTOR_THRESHHOLD
static int nvectors = 0;
#endif
if (dmp->dm_debugLevel)
bu_log("ogl_drawVList()\n");
if (dmp->dm_debugLevel)
bu_log("ogl_drawVList()\n");
/* Viewing region is from -1.0 to +1.0 */
first = 1;
for( BU_LIST_FOR( tvp, rt_vlist, &vp->l ) ) {
register int i;
register int nused = tvp->nused;
register int *cmd = tvp->cmd;
register point_t *pt = tvp->pt;
for( i = 0; i < nused; i++,cmd++,pt++ ) {
if (dmp->dm_debugLevel > 2)
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(pt));
switch( *cmd ) {
case RT_VLIST_LINE_MOVE:
/* Move, start line */
if( first == 0 )
glEnd();
first = 0;
glBegin(GL_LINE_STRIP);
glVertex3dv( *pt );
break;
case RT_VLIST_POLY_START:
/* Start poly marker & normal */
if( first == 0 )
glEnd();
glBegin(GL_POLYGON);
/* Set surface normal (vl_pnt points outward) */
glNormal3dv( *pt );
break;
case RT_VLIST_LINE_DRAW:
case RT_VLIST_POLY_MOVE:
case RT_VLIST_POLY_DRAW:
glVertex3dv( *pt );
break;
case RT_VLIST_POLY_END:
/* Draw, End Polygon */
glVertex3dv( *pt );
glEnd();
/* Viewing region is from -1.0 to +1.0 */
first = 1;
break;
case RT_VLIST_POLY_VERTNORM:
/* Set per-vertex normal. Given before vert. */
glNormal3dv( *pt );
break;
}
}
}
if( first == 0 )
glEnd();
for (BU_LIST_FOR(tvp, rt_vlist, &vp->l)) {
register int i;
register int nused = tvp->nused;
register int *cmd = tvp->cmd;
register point_t *pt = tvp->pt;
for (i = 0; i < nused; i++,cmd++,pt++) {
if (dmp->dm_debugLevel > 2)
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(pt));
switch (*cmd) {
case RT_VLIST_LINE_MOVE:
/* Move, start line */
if (first == 0)
glEnd();
first = 0;
glBegin(GL_LINE_STRIP);
glVertex3dv(*pt);
break;
case RT_VLIST_POLY_START:
/* Start poly marker & normal */
if (first == 0)
glEnd();
glBegin(GL_POLYGON);
/* Set surface normal (vl_pnt points outward) */
glNormal3dv(*pt);
break;
case RT_VLIST_LINE_DRAW:
case RT_VLIST_POLY_MOVE:
case RT_VLIST_POLY_DRAW:
glVertex3dv(*pt);
break;
case RT_VLIST_POLY_END:
/* Draw, End Polygon */
glVertex3dv(*pt);
glEnd();
first = 1;
break;
case RT_VLIST_POLY_VERTNORM:
/* Set per-vertex normal. Given before vert. */
glNormal3dv(*pt);
break;
}
}
return TCL_OK;
#if USE_VECTOR_THRESHHOLD
/*XXX The Tcl_DoOneEvent below causes the following error:
X Error of failed request: GLXBadContextState
*/
nvectors += nused;
if (nvectors >= vectorThreshold) {
if (dmp->dm_debugLevel)
bu_log("ogl_drawVList(): handle Tcl events\n");
nvectors = 0;
/* Handle events in the queue */
while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT));
if (dmp->dm_debugLevel)
bu_log("ogl_drawVList(): handled Tcl events successfully\n");
}
#endif
}
if (first == 0)
glEnd();
return TCL_OK;
}
/*
+18 -14
View File
@@ -22,7 +22,7 @@
* All rights reserved.
*/
#ifndef lint
static char RCSid[] = "@(#)$Header$ (BRL)";
static const char RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -40,6 +40,7 @@ static char RCSid[] = "@(#)$Header$ (BRL)";
#include "dm.h"
#include "dm-plot.h"
#include "solid.h"
#include "plot3.h"
/* Display Manager package interface */
@@ -93,18 +94,19 @@ struct dm dm_plot = {
1.0, /* aspect ratio */
0,
{0, 0},
0,
0,
0,
0,
0,
0, /* clipmin */
0, /* clipmax */
{0, 0, 0, 0, 0}, /* bu_vls path name*/
{0, 0, 0, 0, 0}, /* bu_vls full name drawing window */
{0, 0, 0, 0, 0}, /* bu_vls short name drawing window */
{0, 0, 0}, /* bg color */
{0, 0, 0}, /* fg color */
{0.0, 0.0, 0.0}, /* clipmin */
{0.0, 0.0, 0.0}, /* clipmax */
0, /* no debugging */
0, /* no perspective */
0, /* no lighting */
0, /* no zbuffer */
0 /* no zclipping */
0, /* no zclipping */
0 /* Tcl interpreter */
};
struct plot_vars head_plot_vars;
@@ -117,9 +119,10 @@ static mat_t plotmat;
*
*/
struct dm *
plot_open(argc, argv)
plot_open(interp, argc, argv)
int argc;
char *argv[];
Tcl_Interp *interp;
{
static int count = 0;
struct dm *dmp;
@@ -130,6 +133,7 @@ plot_open(argc, argv)
return DM_NULL;
*dmp = dm_plot; /* struct copy */
dmp->dm_interp = interp;
dmp->dm_vars.priv_vars = (genptr_t)bu_calloc(1, sizeof(struct plot_vars), "plot_open: plot_vars");
BU_GETSTRUCT(dmp->dm_vars.priv_vars, plot_vars);
@@ -311,7 +315,7 @@ plot_loadMatrix(dmp, mat, which_eye)
{
Tcl_Obj *obj;
obj = Tcl_GetObjResult(interp);
obj = Tcl_GetObjResult(dmp->dm_interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
@@ -333,7 +337,7 @@ plot_loadMatrix(dmp, mat, which_eye)
}
bn_mat_copy(plotmat, mat);
Tcl_SetObjResult(interp, obj);
Tcl_SetObjResult(dmp->dm_interp, obj);
return TCL_OK;
}
@@ -590,7 +594,7 @@ plot_debug(dmp, lvl)
{
Tcl_Obj *obj;
obj = Tcl_GetObjResult(interp);
obj = Tcl_GetObjResult(dmp->dm_interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
@@ -598,7 +602,7 @@ plot_debug(dmp, lvl)
(void)fflush(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp);
Tcl_AppendStringsToObj(obj, "flushed\n", (char *)NULL);
Tcl_SetObjResult(interp, obj);
Tcl_SetObjResult(dmp->dm_interp, obj);
return TCL_OK;
}
+15 -12
View File
@@ -20,7 +20,7 @@
* All rights reserved.
*/
#ifndef lint
static char RCSid[] = "@(#)$Header$ (BRL)";
static const char RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
@@ -93,18 +93,19 @@ struct dm dm_ps = {
1.0, /* aspect ratio */
0,
{0, 0},
0,
0,
0,
0,
0,
0, /* clipmin */
0, /* clipmax */
{0, 0, 0, 0, 0}, /* bu_vls path name*/
{0, 0, 0, 0, 0}, /* bu_vls full name drawing window */
{0, 0, 0, 0, 0}, /* bu_vls short name drawing window */
{0, 0, 0}, /* bg color */
{0, 0, 0}, /* fg color */
{0.0, 0.0, 0.0}, /* clipmin */
{0.0, 0.0, 0.0}, /* clipmax */
0, /* no debugging */
0, /* no perspective */
0, /* no lighting */
0, /* no zbuffer */
0 /* no zclipping */
0, /* no zclipping */
0 /* Tcl interpreter */
};
char ps_usage[] = "Usage: ps [-f font] [-t title] [-c creator] [-s size in inches]\
@@ -120,7 +121,8 @@ static mat_t psmat;
*
*/
struct dm *
ps_open(argc, argv)
ps_open(interp, argc, argv)
Tcl_Interp *interp;
int argc;
char *argv[];
{
@@ -133,6 +135,7 @@ ps_open(argc, argv)
return DM_NULL;
*dmp = dm_ps; /* struct copy */
dmp->dm_interp = interp;
dmp->dm_vars.priv_vars = (genptr_t)bu_calloc(1, sizeof(struct ps_vars), "ps_open: ps_vars");
if (dmp->dm_vars.priv_vars == (genptr_t)NULL) {
@@ -411,7 +414,7 @@ int which_eye;
{
Tcl_Obj *obj;
obj = Tcl_GetObjResult(interp);
obj = Tcl_GetObjResult(dmp->dm_interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
@@ -434,7 +437,7 @@ int which_eye;
bn_mat_copy(psmat, mat);
Tcl_SetObjResult(interp, obj);
Tcl_SetObjResult(dmp->dm_interp, obj);
return TCL_OK;
}
+36 -34
View File
@@ -96,41 +96,41 @@ static void dmo_fbs_callback();
static struct dm_obj HeadDMObj; /* head of display manager object list */
static struct bu_cmdtab dmo_cmds[] = {
"bg", dmo_bg_tcl,
"bounds", dmo_bounds_tcl,
"clear", dmo_clear_tcl,
"close", dmo_close_tcl,
"configure", dmo_configure_tcl,
"debug", dmo_debug_tcl,
"drawBegin", dmo_drawBegin_tcl,
"drawEnd", dmo_drawEnd_tcl,
"drawGeom", dmo_drawGeom_tcl,
"drawLine", dmo_drawLine_tcl,
"drawPoint", dmo_drawPoint_tcl,
"drawSList", dmo_drawSList_tcl,
"drawString", dmo_drawString_tcl,
"drawVList", dmo_drawVList_tcl,
"fg", dmo_fg_tcl,
"flush", dmo_flush_tcl,
"get_aspect", dmo_get_aspect_tcl,
"light", dmo_light_tcl,
"linestyle", dmo_lineStyle_tcl,
"linewidth", dmo_lineWidth_tcl,
{"bg", dmo_bg_tcl},
{"bounds", dmo_bounds_tcl},
{"clear", dmo_clear_tcl},
{"close", dmo_close_tcl},
{"configure", dmo_configure_tcl},
{"debug", dmo_debug_tcl},
{"drawBegin", dmo_drawBegin_tcl},
{"drawEnd", dmo_drawEnd_tcl},
{"drawGeom", dmo_drawGeom_tcl},
{"drawLine", dmo_drawLine_tcl},
{"drawPoint", dmo_drawPoint_tcl},
{"drawSList", dmo_drawSList_tcl},
{"drawString", dmo_drawString_tcl},
{"drawVList", dmo_drawVList_tcl},
{"fg", dmo_fg_tcl},
{"flush", dmo_flush_tcl},
{"get_aspect", dmo_get_aspect_tcl},
{"light", dmo_light_tcl},
{"linestyle", dmo_lineStyle_tcl},
{"linewidth", dmo_lineWidth_tcl},
#ifdef USE_FBSERV
"listen", dmo_listen_tcl,
{"listen", dmo_listen_tcl},
#endif
"loadmat", dmo_loadmat_tcl,
"normal", dmo_normal_tcl,
"observer", dmo_observer_tcl,
"perspective", dmo_perspective_tcl,
{"loadmat", dmo_loadmat_tcl},
{"normal", dmo_normal_tcl},
{"observer", dmo_observer_tcl},
{"perspective", dmo_perspective_tcl},
#ifdef USE_FBSERV
"refreshfb", dmo_refreshFb_tcl,
{"refreshfb", dmo_refreshFb_tcl},
#endif
"size", dmo_size_tcl,
"sync", dmo_sync_tcl,
"zbuffer", dmo_zbuffer_tcl,
"zclip", dmo_zclip_tcl,
(char *)0, (int (*)())0
{"size", dmo_size_tcl},
{"sync", dmo_sync_tcl},
{"zbuffer", dmo_zbuffer_tcl},
{"zclip", dmo_zclip_tcl},
{(char *)0, (int (*)())0}
};
/*
@@ -318,7 +318,10 @@ dmo_open_tcl(clientData, interp, argc, argv)
av[i+newargs] = argv[i];
av[i+newargs] = (char *)NULL;
if ((dmp = dm_open(type, ac, av)) == DM_NULL) {
if ((dmp = dm_open(interp, type, ac, av)) == DM_NULL) {
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
Tcl_AppendStringsToObj(obj,
"dmo_open_tcl: Failed to open - ",
argv[name_index],
@@ -339,7 +342,6 @@ dmo_open_tcl(clientData, interp, argc, argv)
/* initialize dm_obj */
bu_vls_init(&dmop->dmo_name);
bu_vls_strcpy(&dmop->dmo_name,argv[name_index]);
dmop->dmo_interp = interp;
dmop->dmo_dmp = dmp;
VSETALL(dmop->dmo_dmp->dm_clipmin, -2048.0);
VSETALL(dmop->dmo_dmp->dm_clipmax, 2047.0);
@@ -1763,6 +1765,6 @@ dmo_fbs_callback(clientData)
{
struct dm_obj *dmop = (struct dm_obj *)clientData;
bu_observer_notify(dmop->dmo_interp, &dmop->dmo_observers,
bu_observer_notify(dmop->dmo_dmp->dm_interp, &dmop->dmo_observers,
bu_vls_addr(&dmop->dmo_name));
}
+23 -14
View File
@@ -31,30 +31,39 @@ extern int Dmo_Init();
HIDDEN int dm_validXType_tcl();
HIDDEN int dm_bestXType_tcl();
int vectorThreshold = 100000;
HIDDEN struct bu_cmdtab cmdtab[] = {
"dm_validXType", dm_validXType_tcl,
"dm_bestXType", dm_bestXType_tcl,
(char *)0, (int (*)())0
{"dm_validXType", dm_validXType_tcl},
{"dm_bestXType", dm_bestXType_tcl},
{(char *)0, (int (*)())0}
};
int
Dm_Init(interp)
Tcl_Interp *interp;
Tcl_Interp *interp;
{
char *version_number;
char *version_number;
struct bu_vls vls;
/* register commands */
bu_register_cmds(interp, cmdtab);
/* register commands */
bu_register_cmds(interp, cmdtab);
/* initialize display manager object code */
Dmo_Init(interp);
bu_vls_init(&vls);
bu_vls_strcpy(&vls, "vectorThreshold");
Tcl_LinkVar(interp, bu_vls_addr(&vls), (char *)&vectorThreshold,
TCL_LINK_INT);
bu_vls_free(&vls);
Tcl_SetVar(interp, "dm_version", (char *)dm_version+5, TCL_GLOBAL_ONLY);
Tcl_Eval(interp, "lindex $dm_version 2");
version_number = Tcl_GetStringResult(interp);
Tcl_PkgProvide(interp, "Dm", version_number);
/* initialize display manager object code */
Dmo_Init(interp);
return TCL_OK;
Tcl_SetVar(interp, "dm_version", (char *)dm_version+5, TCL_GLOBAL_ONLY);
Tcl_Eval(interp, "lindex $dm_version 2");
version_number = Tcl_GetStringResult(interp);
Tcl_PkgProvide(interp, "Dm", version_number);
return TCL_OK;
}
HIDDEN int
+17 -6
View File
@@ -54,19 +54,25 @@
#endif
#ifndef lint
static char sccsid[] = "@(#)if_X24.c version 1.40 (22 Nov 1994)";
static char RCSid[] = "@(#)$Header$ (ARL)";
static const char sccsid[] = "@(#)if_X24.c version 1.40 (22 Nov 1994)";
static const char RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#if defined(USE_SYS_TIME_H)
# include <sys/time.h>
#endif
#include <time.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "fb.h"
@@ -1539,6 +1545,7 @@ struct xinfo *xi;
}
static
int
xsetup(ifp, width, height)
FBIO *ifp;
int width, height;
@@ -1550,6 +1557,7 @@ int width, height;
XWMHints xwmh; /* size guidelines for window mngr */
XSetWindowAttributes xswa;
XRectangle rect;
char *xname;
#if X_DBG
printf("xsetup(ifp:0x%x, width:%d, height:%d) entered\n", ifp, width, height);
@@ -1561,9 +1569,12 @@ printf("xsetup(ifp:0x%x, width:%d, height:%d) entered\n", ifp, width, height);
xi->xi_xheight = height;
/* Open the display - use the env variable DISPLAY */
if ((xi->xi_dpy = XOpenDisplay(NULL)) == NULL) {
fb_log("if_X: Can't open X display \"%s\"\n",
XDisplayName(NULL));
xname = XDisplayName(NULL);
/* Attempt one level of fallback, esp. for fbserv daemon */
if( !xname || *xname == '\0' ) xname = ":0";
if ((xi->xi_dpy = XOpenDisplay(xname)) == NULL) {
fb_log("if_X: Can't open X display \"%s\"\n", xname);
return -1;
}
@@ -2318,7 +2329,7 @@ Display *dpy;
visual = vp[i].visual;
printf("---- Visual 0x%lx (%d)----\n", visual, i);
printf("---- Visual 0x%lx (%d)----\n", (unsigned long int)visual, i);
printf("screen: %d\n", vp[i].screen);
printf("depth : %d\n", vp[i].depth);
+15 -5
View File
@@ -15,7 +15,7 @@
--with-tcl=[[pwd]]/LIBTCL_DIR \
--with-tk=[[pwd]]/LIBTK_DIR
#define PRODUCTS libitcl3.0.a& itclsh& libitk3.0.a& itkwish&
#define AFTER_MAKE /**/
#define AFTER_MAKE rm -f libitcl.a libitk.a ; ln -s libitcl3.0.a libitcl.a ; ln -s libitk3.0.a libitk.a
#else
/* Shared library case */
#define ITCL_OPTS --srcdir=[[pwd]]/../SRCDIR/ --enable-shared --quiet \
@@ -28,7 +28,10 @@
#define AFTER_MAKE /* mv -f libitcl3.0.so libitcl3.0.so''[[LIBVERS]] ; \
mv -f libitk3.0.so libitk3.0.so''[[LIBVERS]] ; \
sharedliblink.sh libitcl3.0.so''[[LIBVERS]] ; \
sharedliblink.sh libitk3.0.so''[[LIBVERS]] */
sharedliblink.sh libitk3.0.so''[[LIBVERS]] ; */ \
rm -f libitcl.so libitk.so ; \
ln -s libitk3.0.so libitk.so ; \
ln -s libitcl3.0.so libitcl.so
#endif
/* Rule to see if cake is running with -s flag */
@@ -55,15 +58,22 @@ Makefile.MTYPE cache.MTYPE: if not exist Makefile.MTYPE or not exist cache.MTYP
echo ../SRCDIR/fix_makefile.sh '>' Makefile.MTYPE; \
../SRCDIR/fix_makefile.sh > Makefile.MTYPE)
clean&:
make -f Makefile clean
clean&: Makefile.MTYPE
make -f Makefile.MTYPE clean
noprod&:
rm -rf libtcl.*
clobber&:
#ifdef NFS
clobber&: Makefile.MTYPE
make -f Makefile.MTYPE clean
rm -f *.MTYPE *.o config.log config.status Makefile lib* itclsh itkwish
rm -rf itcl itk iwidgets*
#else
clobber&: Makefile.MTYPE
make -f Makefile.MTYPE clean
rm -f *.MTYPE *.o config.log config.status Makefile lib* itclsh itkwish
#endif
install&: Makefile.MTYPE
make -f Makefile.MTYPE install
+1 -1
View File
@@ -6,7 +6,7 @@
#define PRODUCTS libpkg.ARCH_SUF
#define SRCDIR libpkg
#define FILES pkg
#define FILES pkg tcl
#define SRCSUFF .c
#define MANSECTION 3
+22
View File
@@ -0,0 +1,22 @@
/*
* T C L . C
*
* LIBPKG's tcl interface.
*
* Source -
* SLAD CAD Team
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005
*
* Author -
* Robert G. Parker
*/
#include "conf.h"
#include "tcl.h"
int
Pkg_Init(interp)
Tcl_Interp *interp;
{
return TCL_OK;
}
+1 -2
View File
@@ -20,14 +20,13 @@
bomb \
db_open db_scan db_lookup db_io db_alloc db_walk \
db_path db_tree db_comb db_anim db_match \
db5_scan db5_io db5_comb db5_alloc \
db5_scan \
memalloc \
table dir tree prep \
g_arb g_ars g_ebm g_ell g_half g_pg g_rec g_sph g_nurb \
g_tgc g_torus g_vol g_arbn g_part g_pipe g_nmg \
g_rpc g_rhc g_epa g_ehy g_eto g_grip g_hf g_dsp g_sketch g_extrude \
g_submodel g_cline g_bot \
db5_types db5_bin \
cmd mater roots spectrum \
rtlex vlist regionfix htbl \
nmg_mk nmg_misc nmg_bool nmg_eval nmg_inter nmg_plot nmg_ck \
+2 -2
View File
@@ -778,9 +778,9 @@ bu_bomb("vol_vol s2");
}
} else {
/*
* take the region who's seg started at start of partition
* take the region with largest inhit
*/
if( s1->seg_in.hit_dist == pp->pt_inhit->hit_dist ) {
if( s1->seg_in.hit_dist >= s2->seg_in.hit_dist ) {
/* keep fr1, delete fr2 */
*fr2 = REGION_NULL;
} else {
+10 -6
View File
@@ -90,7 +90,7 @@ char *argv[];
}
/* Scan the database */
db_dirbuild( dbip );
db_scan(dbip, (int (*)())db_diradd, 1);
for( i=2 ; i<argc ; i++ )
{
@@ -99,7 +99,12 @@ char *argv[];
printf( "%s\n" , argv[i] );
dp = db_lookup( dbip , argv[i] , 1 );
if( rt_db_get_internal( &ip, dp, dbip, NULL ) < 0 ) {
if( db_get_external( &ep , dp , dbip ) )
{
bu_log( "db_get_external failed for %s\n" , argv[i] );
continue;
}
if( rt_comb_v4_import( &ip , &ep , NULL ) < 0 ) {
bu_log("import of %s failed\n", dp->d_namep);
continue;
}
@@ -110,7 +115,6 @@ char *argv[];
if( ip.idb_type != ID_COMBINATION )
{
bu_log( "idb_type = %d\n" , ip.idb_type );
rt_db_free_internal( &ip );
continue;
}
@@ -152,7 +156,7 @@ char *argv[];
fwrite( ep.ext_buf, ep.ext_nbytes, 1, fp );
fclose(fp);
}
bu_free_external( &ep );
db_free_external( &ep );
bu_vls_free( &file );
/* Convert internal back to external, and write both to files */
@@ -166,11 +170,11 @@ char *argv[];
fwrite( ep.ext_buf, ep.ext_nbytes, 1, fp );
fclose(fp);
}
bu_free_external( &ep );
db_free_external( &ep );
bu_vls_free( &file );
/* Test the lumberjacks */
rt_db_free_internal( &ip );
ip.idb_meth->ft_ifree( &ip );
}
}
-52
View File
@@ -1,52 +0,0 @@
/*
* C O N S T . C
*
* Constants used by the ray tracing library.
*
* 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) 1989 by the United States Army.
* All rights reserved.
*/
#ifndef lint
static char RCSmat[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
#include <stdio.h>
#include "machine.h"
#include "vmath.h"
#include "raytrace.h"
CONST double rt_pi = 3.14159265358979323846; /* pi */
CONST double rt_twopi = 6.28318530717958647692; /* pi*2 */
CONST double rt_halfpi = 1.57079632679489661923; /* pi/2 */
CONST double rt_quarterpi=0.78539816339744830961; /* pi/4 */
CONST double rt_invpi = 0.318309886183790671538; /* 1/pi */
CONST double rt_inv2pi = 0.159154943091895335769; /* 1/(pi*2) */
CONST double rt_inv4pi = 0.07957747154594766788; /* 1/(pi*4) */
CONST double rt_inv255 = 1.0/255.0;
CONST double rt_degtorad = 0.0174532925199433; /* (pi*2)/360 */
CONST double rt_radtodeg = 57.29577951308230698802; /* 360/(pi*2) */
CONST mat_t rt_identity = {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
#ifdef ipsc860
/* Hack to work around the broken iPSC/860 loader. It doesn't
* see the definition in global.c, probably because there is no
* .text or .data there that it needs.
*/
struct rt_g rt_g;
#endif
-202
View File
@@ -1,202 +0,0 @@
/*
* D B _ A L L O C 5 . C
*
* Handle disk space allocation in the BRL-CAD v5 database.
*
* Author -
* Michael John Muuss
*
* Source -
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5068 USA
*
* Distribution Status -
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static const char RCSid[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
#include <stdio.h>
#ifdef USE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "bu.h"
#include "vmath.h"
#include "db5.h"
#include "raytrace.h"
#include "./debug.h"
/*
* D B 5 _ W R I T E _ F R E E
*
* Create a v5 database "free" object of the specified size,
* and place it at the indicated location in the database.
*
* Returns -
* 0 OK
* -1 Fail
*/
int
db5_write_free( struct db_i *dbip, struct directory *dp, long length )
{
struct bu_external ext;
RT_CK_DBI(dbip);
RT_CK_DIR(dp);
BU_INIT_EXTERNAL( &ext );
db5_make_free_object( &ext, length );
if( dp->d_flags & RT_DIR_INMEM ) {
bcopy( (char *)ext.ext_buf, dp->d_un.ptr, ext.ext_nbytes );
bu_free_external( &ext );
return 0;
}
if( db_write( dbip, (char *)ext.ext_buf, ext.ext_nbytes, dp->d_addr ) < 0 ) {
bu_free_external( &ext );
return -1;
}
bu_free_external( &ext );
return 0;
}
/*
* D B 5 _ R E A L L O C
*
* Change the size of a v5 database object.
*
* If the object is getting smaller, break it into two pieces,
* and write out free objects for both.
* The caller is expected to re-write new data on the first one.
*
* If the object is getting larger, seek a suitable "hole" large enough
* to hold it, throwing back any surplus, properly marked.
*
* If the object is getting larger and there is no suitable "hole"
* in the database, extend the file, write a free object in the
* new space, and write a free object in the old space.
*
* There is no point to trying to extend in place, that would require
* two searches through the memory map, and doesn't save any disk I/O.
*
* Returns -
* 0 OK
* -1 Failure
*/
int
db5_realloc( struct db_i *dbip, struct directory *dp, struct bu_external *ep )
{
long baseaddr;
long baselen;
RT_CK_DBI(dbip);
RT_CK_DIR(dp);
BU_CK_EXTERNAL(ep);
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) dbip=x%x, dp=x%x, ext_nbytes=%ld\n",
dp->d_namep, dbip, dp, ep->ext_nbytes );
BU_ASSERT_LONG( ep->ext_nbytes&7, ==, 0 );
if( ep->ext_nbytes == dp->d_len ) return 0;
baseaddr = dp->d_addr;
baselen = dp->d_len;
if( dp->d_flags & RT_DIR_INMEM ) {
if( dp->d_un.ptr ) {
dp->d_un.ptr = bu_realloc( dp->d_un.ptr,
ep->ext_nbytes, "db5_realloc() d_un.ptr" );
} else {
dp->d_un.ptr = bu_malloc( ep->ext_nbytes, "db5_realloc() d_un.ptr" );
}
dp->d_len = ep->ext_nbytes;
return 0;
}
if( dbip->dbi_read_only ) {
bu_log("db5_realloc(%s) on READ-ONLY file\n", dp->d_namep);
return(-1);
}
/* If the object is getting smaller... */
if( ep->ext_nbytes < dp->d_len ) {
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) object is getting smaller\n", dp->d_namep);
/* First, erase front half of storage to desired size. */
dp->d_len = ep->ext_nbytes;
if( db5_write_free( dbip, dp, dp->d_len ) < 0 ) return -1;
/* Second, erase back half of storage to remainder. */
dp->d_addr = baseaddr + ep->ext_nbytes;
dp->d_len = baselen - ep->ext_nbytes;
if( db5_write_free( dbip, dp, dp->d_len ) < 0 ) return -1;
/* Finally, update tables */
rt_memfree( &(dbip->dbi_freep), dp->d_len, dp->d_addr );
dp->d_addr = baseaddr;
dp->d_len = ep->ext_nbytes;
return 0;
}
/* The object is getting larger... */
/* Start by zapping existing database object into a free object */
if( dp->d_addr != -1L ) {
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) releasing storage at x%x, len=%d\n", dp->d_namep, dp->d_addr, dp->d_len);
rt_memfree( &(dbip->dbi_freep), dp->d_len, dp->d_addr );
if( db5_write_free( dbip, dp, dp->d_len ) < 0 ) return -1;
baseaddr = dp->d_addr = -1L; /* sanity */
}
/* Can we obtain a free block somewhere else? */
{
struct mem_map *mmp;
long newaddr;
if( (mmp = rt_memalloc_nosplit( &(dbip->dbi_freep), ep->ext_nbytes )) != MAP_NULL ) {
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) obtained free block at x%x, len=%d\n", dp->d_namep, mmp->m_addr, mmp->m_size );
BU_ASSERT_LONG( mmp->m_size, >=, ep->ext_nbytes );
if( mmp->m_size == ep->ext_nbytes ) {
/* No need to reformat, existing free object is perfect */
dp->d_addr = mmp->m_addr;
dp->d_len = ep->ext_nbytes;
return 0;
}
newaddr = mmp->m_addr;
if( mmp->m_size > ep->ext_nbytes ) {
/* Reformat and free the surplus */
dp->d_addr = mmp->m_addr + ep->ext_nbytes;
dp->d_len = mmp->m_size - ep->ext_nbytes;
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) returning surplus at x%x, len=%d\n", dp->d_namep, dp->d_addr, dp->d_len );
if( db5_write_free( dbip, dp, dp->d_len ) < 0 ) return -1;
rt_memfree( &(dbip->dbi_freep), dp->d_len, dp->d_addr );
/* mmp is invalid beyond here! */
}
dp->d_addr = newaddr;
dp->d_len = ep->ext_nbytes;
/* Erase the new place */
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) utilizing free block at addr=x%x, len=%d\n", dp->d_namep, dp->d_addr, dp->d_len);
if( db5_write_free( dbip, dp, dp->d_len ) < 0 ) return -1;
return 0;
}
}
/* No free storage of the desired size, extend the database */
dp->d_addr = dbip->dbi_eof;
dbip->dbi_eof += ep->ext_nbytes;
dp->d_len = ep->ext_nbytes;
if(rt_g.debug&DEBUG_DB) bu_log("db5_realloc(%s) extending database addr=x%x, len=%d\n", dp->d_namep, dp->d_addr, dp->d_len);
if( db5_write_free( dbip, dp, dp->d_len ) < 0 ) return -1;
return 0;
}
-331
View File
@@ -1,331 +0,0 @@
/*
* D B 5 _ B I N . C
*
* Purpose -
* Handle bulk binary objects
*
* Author -
* Paul J. Tanenbaum
* Source -
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5066
*
* Copyright Notice -
* This software is Copyright (C) 2000 by the United States Army.
* All rights reserved.
*/
#ifndef lint
static char RCSell[] = "@(#)$Header$ (BRL)";
#endif
#include "conf.h"
#include <stdio.h>
#include <math.h>
#include "machine.h"
#include "bu.h"
#include "vmath.h"
#include "db5.h"
#include "nmg.h"
#include "raytrace.h"
#include "nurb.h"
#include "rtgeom.h"
#include "./debug.h"
/*
* R T _ B I N U N I F _ I M P O R T 5
*
* Import a uniform-array binary object from the database format to
* the internal structure.
*/
int
rt_binunif_import5( struct rt_db_internal *ip,
CONST unsigned char minor_type,
CONST struct bu_external *ep,
CONST struct db_i *dbip )
{
struct rt_binunif_internal *bip;
int i;
unsigned char *srcp;
unsigned long *ldestp;
unsigned short *sdestp;
BU_CK_EXTERNAL( ep );
/*
* There's no particular size to expect
*
* BU_ASSERT_LONG( ep->ext_nbytes, ==, SIZEOF_NETWORK_DOUBLE * 3*4 );
*/
RT_CK_DB_INTERNAL( ip );
ip->idb_type = ID_BINUNIF;
ip->idb_meth = 0;
ip->idb_ptr = bu_malloc( sizeof(struct rt_binunif_internal),
"rt_binunif_internal");
bip = (struct rt_binunif_internal *)ip->idb_ptr;
bip->magic = RT_BINUNIF_INTERNAL_MAGIC;
bip->type = minor_type;
/*
* Convert from database (network) to internal (host) format
*/
switch (bip->type) {
case DB5_MINORTYPE_BINU_FLOAT:
bip->count = ep->ext_nbytes/SIZEOF_NETWORK_FLOAT;
bip->u.uint8 = (unsigned char *) bu_malloc( bip->count * sizeof(float),
"rt_binunif_internal" );
ntohf( (unsigned char *) bip->u.uint8,
ep->ext_buf, ep->ext_nbytes/SIZEOF_NETWORK_FLOAT );
break;
case DB5_MINORTYPE_BINU_DOUBLE:
bip->count = ep->ext_nbytes/SIZEOF_NETWORK_DOUBLE;
bip->u.uint8 = (unsigned char *) bu_malloc( bip->count * sizeof(float),
"rt_binunif_internal" );
ntohd( (unsigned char *) bip->u.uint8,
ep->ext_buf, ep->ext_nbytes/SIZEOF_NETWORK_DOUBLE );
break;
case DB5_MINORTYPE_BINU_8BITINT:
case DB5_MINORTYPE_BINU_8BITINT_U:
bip->count = ep->ext_nbytes;
bip->u.uint8 = (unsigned char *) bu_malloc( ep->ext_nbytes,
"rt_binunif_internal" );
bcopy( (char *) bip->u.uint8, (char *) ep->ext_buf, ep->ext_nbytes );
break;
case DB5_MINORTYPE_BINU_16BITINT:
case DB5_MINORTYPE_BINU_16BITINT_U:
bip->count = ep->ext_nbytes/2;
bip->u.uint8 = (unsigned char *) bu_malloc( ep->ext_nbytes,
"rt_binunif_internal" );
srcp = (unsigned char *) ep->ext_buf;
sdestp = (unsigned short *) bip->u.uint8;
for (i = 0; i < bip->count; ++i, ++sdestp, srcp += 2) {
*sdestp = bu_gshort( (unsigned char *) srcp );
}
break;
case DB5_MINORTYPE_BINU_32BITINT:
case DB5_MINORTYPE_BINU_32BITINT_U:
bip->count = ep->ext_nbytes/4;
bip->u.uint8 = (unsigned char *) bu_malloc( ep->ext_nbytes,
"rt_binunif_internal" );
srcp = (unsigned char *) ep->ext_buf;
ldestp = (unsigned long *) bip->u.uint8;
for (i = 0; i < bip->count; ++i, ++ldestp, srcp += 4) {
*ldestp = bu_glong( (unsigned char *) srcp );
}
break;
case DB5_MINORTYPE_BINU_64BITINT:
case DB5_MINORTYPE_BINU_64BITINT_U:
bu_log("rt_binunif_import5() Can't handle 64-bit integers yet\n");
return -1;
}
return 0; /* OK */
}
/*
* R T _ B I N E X P M _ I M P O R T 5
*
* Import an experimental binary object from the database format to
* the internal structure.
*/
int
rt_binexpm_import5( struct rt_db_internal *ip,
CONST unsigned char minor_type,
CONST struct bu_external *ep,
CONST struct db_i *dbip )
{
bu_log("rt_binexpm_import5() not implemented yet\n");
return -1;
}
/*
* R T _ B I N M I M E _ I M P O R T 5
*
* Import a MIME-typed binary object from the database format to
* the internal structure.
*/
int
rt_binmime_import5( struct rt_db_internal *ip,
CONST unsigned char minor_type,
CONST struct bu_external *ep,
CONST struct db_i *dbip )
{
bu_log("rt_binmime_import5() not implemented yet\n");
return -1;
}
/*
* R T _ B I N _ I M P O R T 5
*
* Wrapper for importing binary objects from the database format to
* the internal structure.
*/
int
rt_bin_import5( struct rt_db_internal *ip,
CONST unsigned char major_type,
CONST unsigned char minor_type,
CONST struct bu_external *ep,
CONST struct db_i *dbip )
{
switch (major_type) {
case DB5_MAJORTYPE_BINARY_EXPM:
return rt_binexpm_import5( ip, minor_type, ep, dbip );
case DB5_MAJORTYPE_BINARY_UNIF:
return rt_binunif_import5( ip, minor_type, ep, dbip );
case DB5_MAJORTYPE_BINARY_MIME:
return rt_binmime_import5( ip, minor_type, ep, dbip );
}
}
/*
* R T _ B I N U N I F _ E X P O R T 5
*/
int
rt_binunif_export5( struct bu_external *ep,
CONST struct rt_db_internal *ip,
CONST struct db_i *dbip )
{
struct rt_binunif_internal *bip;
int i;
unsigned char *destp;
unsigned long *lsrcp;
unsigned short *ssrcp;
RT_CK_DB_INTERNAL(ip);
if( ip->idb_type != ID_BINUNIF ) return -1;
bip = (struct rt_binunif_internal *)ip->idb_ptr;
RT_CK_BINUNIF(bip);
BU_INIT_EXTERNAL(ep);
/*
* Convert from internal (host) to database (network) format
*/
switch (bip->type) {
case DB5_MINORTYPE_BINU_FLOAT:
ep->ext_nbytes = bip->count * SIZEOF_NETWORK_FLOAT;
ep->ext_buf = (genptr_t)bu_malloc( ep->ext_nbytes,
"binunif external");
htonf( ep->ext_buf, (unsigned char *) bip->u.uint8, bip->count );
break;
case DB5_MINORTYPE_BINU_DOUBLE:
ep->ext_nbytes = bip->count * SIZEOF_NETWORK_DOUBLE;
ep->ext_buf = (genptr_t)bu_malloc( ep->ext_nbytes,
"binunif external");
htond( ep->ext_buf, (unsigned char *) bip->u.uint8, bip->count );
break;
case DB5_MINORTYPE_BINU_8BITINT:
case DB5_MINORTYPE_BINU_8BITINT_U:
ep->ext_nbytes = bip->count;
ep->ext_buf = (genptr_t)bu_malloc( ep->ext_nbytes,
"binunif external");
bcopy( (char *) ep->ext_buf, (char *) bip->u.uint8, bip->count );
break;
case DB5_MINORTYPE_BINU_16BITINT:
case DB5_MINORTYPE_BINU_16BITINT_U:
ep->ext_nbytes = bip->count * 2;
ep->ext_buf = (genptr_t)bu_malloc( ep->ext_nbytes,
"binunif external");
ssrcp = (unsigned short *) bip->u.uint8;
destp = (unsigned char *) ep->ext_buf;
for (i = 0; i < bip->count; ++i, ++destp, ssrcp += 2)
(void) bu_pshort( destp, *ssrcp );
break;
case DB5_MINORTYPE_BINU_32BITINT:
case DB5_MINORTYPE_BINU_32BITINT_U:
ep->ext_nbytes = bip->count * 4;
ep->ext_buf = (genptr_t)bu_malloc( ep->ext_nbytes,
"binunif external");
lsrcp = (unsigned long *) bip->u.uint8;
destp = (unsigned char *) ep->ext_buf;
for (i = 0; i < bip->count; ++i, ++destp, lsrcp += 4)
(void) bu_plong( destp, *lsrcp );
break;
case DB5_MINORTYPE_BINU_64BITINT:
case DB5_MINORTYPE_BINU_64BITINT_U:
bu_log("rt_binunif_export5() Can't handle 64-bit integers yet\n");
return -1;
}
return 0;
}
/*
* R T _ B I N U N I F _ D E S C R I B E
*
* Make human-readable formatted presentation of this solid.
* First line describes type of solid.
* Additional lines are indented one tab, and give parameter values.
*/
int
rt_binunif_describe( struct bu_vls *str,
CONST struct rt_db_internal *ip,
int verbose,
double mm2local )
{
register struct rt_binunif_internal *bip;
char buf[256];
unsigned short wid;
bip = (struct rt_binunif_internal *) ip->idb_ptr;
RT_CK_BINUNIF(bip);
bu_vls_strcat( str, "uniform-array binary object (BINUNIF)\n");
wid = (bip->type & DB5_MINORTYPE_BINU_WID_MASK) >> 4;
switch (wid) {
case 0:
sprintf( buf, "%d ", bip->count ); break;
case 1:
sprintf( buf, "%d pairs of ", bip->count / 2 ); break;
case 2:
sprintf( buf, "%d triples of ", bip->count / 3 ); break;
case 3:
sprintf( buf, "%d quadruples of ", bip->count / 4 ); break;
}
bu_vls_strcat( str, buf );
switch (bip->type & DB5_MINORTYPE_BINU_ATM_MASK) {
case DB5_MINORTYPE_BINU_FLOAT:
bu_vls_strcat( str, "floats\n"); break;
case DB5_MINORTYPE_BINU_DOUBLE:
bu_vls_strcat( str, "doubles\n"); break;
case DB5_MINORTYPE_BINU_8BITINT:
bu_vls_strcat( str, "chars\n"); break;
case DB5_MINORTYPE_BINU_16BITINT:
bu_vls_strcat( str, "16-bit ints\n"); break;
case DB5_MINORTYPE_BINU_32BITINT:
bu_vls_strcat( str, "32-bit ints\n"); break;
case DB5_MINORTYPE_BINU_64BITINT:
bu_vls_strcat( str, "64-bit ints\n"); break;
case DB5_MINORTYPE_BINU_8BITINT_U:
bu_vls_strcat( str, "unsigned chars\n"); break;
case DB5_MINORTYPE_BINU_16BITINT_U:
bu_vls_strcat( str, "unsigned 16-bit ints\n"); break;
case DB5_MINORTYPE_BINU_32BITINT_U:
bu_vls_strcat( str, "unsigned 32-bit ints\n"); break;
case DB5_MINORTYPE_BINU_64BITINT_U:
bu_vls_strcat( str, "unsigned 64-bit ints\n"); break;
}
return(0);
}
/*
* R T _ B I N U N I F _ I F R E E
*
* Free the storage associated with the rt_db_internal version of this solid.
*/
void
rt_binunif_ifree( struct rt_db_internal *ip )
{
struct rt_binunif_internal *bip;
RT_CK_DB_INTERNAL(ip);
bip = (struct rt_binunif_internal *)ip->idb_ptr;
RT_CK_BINUNIF(bip);
bu_free( (genptr_t) bip->u.uint8, "binunif ifree" );
bu_free( ip->idb_ptr, "binunif ifree" );
ip->idb_ptr = GENPTR_NULL;
}
-628
View File
@@ -1,628 +0,0 @@
/*
* D B 5 _ C O M B . C
*
* Handle import/export of combinations (union tree) in v5 format.
*
* The on-disk record looks like this:
* width byte
* n matricies (only non-identity matricies stored).
* n leaves
* len of RPN expression. (len=0 signals all-union expression)
* depth of stack
* Section 1: matricies
* Section 2: leaves
* Section 3: (Optional) RPN expression.
*
* Encoding of a matrix is (ELEMENTS_PER_MAT * SIZEOF_NETWORK_DOUBLE) bytes,
* in network order (big-Endian, IEEE double precision).
*
* Author -
* Michael John Muuss
*
* Source -
* The U. S. Army Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5068 USA
*
* Distribution Status -
* Public Domain, Distribution Unlimited.
*/
#ifndef lint
static char RCSid[] = "@(#)$Header$ (ARL)";
#endif
#include "conf.h"
#include <stdio.h>
#ifdef USE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "machine.h"
#include "bu.h"
#include "vmath.h"
#include "bn.h"
#include "db5.h"
#include "raytrace.h"
#include "./debug.h"
struct db_tree_counter_state {
long magic;
long n_mat; /* # leaves with non-identity matricies */
long n_leaf; /* # leaf nodes */
long n_oper; /* # operator nodes */
long leafbytes; /* # bytes for name section */
int non_union_seen; /* boolean, 1 = non-unions seen */
};
#define DB_TREE_COUNTER_STATE_MAGIC 0x64546373 /* dTcs */
#define DB_CK_TREE_COUNTER_STATE(_p) BU_CKMAG(_p, DB_TREE_COUNTER_STATE_MAGIC, "db_tree_counter_state");
/*
* D B _ T R E E _ C O U N T E R
*
* Count number of non-identity matricies,
* number of leaf nodes, number of operator nodes, etc.
*
* Returns -
* maximum depth of stack needed to unpack this tree, if serialized.
*
* Notes -
* We over-estimate the size of the width fields used for
* holding the matrix subscripts.
* The caller is responsible for correcting by saying:
* tcsp->leafbytes -= tcsp->n_leaf * (8 - db5_enc_len[wid]);
*/
long
db_tree_counter( CONST union tree *tp, struct db_tree_counter_state *tcsp )
{
long ldepth, rdepth;
RT_CK_TREE(tp);
DB_CK_TREE_COUNTER_STATE(tcsp);
switch( tp->tr_op ) {
case OP_DB_LEAF:
tcsp->n_leaf++;
if( tp->tr_l.tl_mat ) tcsp->n_mat++;
/* Over-estimate storage requirement for matrix # */
tcsp->leafbytes += strlen(tp->tr_l.tl_name) + 1 + 8;
return 1;
case OP_NOT:
/* Unary ops */
tcsp->n_oper++;
tcsp->non_union_seen = 1;
return 1 + db_tree_counter( tp->tr_b.tb_left, tcsp );
case OP_UNION:
/* This node is known to be a binary op */
tcsp->n_oper++;
ldepth = db_tree_counter( tp->tr_b.tb_left, tcsp );
rdepth = db_tree_counter( tp->tr_b.tb_right, tcsp );
if( ldepth > rdepth ) return ldepth;
return rdepth;
case OP_INTERSECT:
case OP_SUBTRACT:
case OP_XOR:
/* This node is known to be a binary op */
tcsp->n_oper++;
tcsp->non_union_seen = 1;
ldepth = db_tree_counter( tp->tr_b.tb_left, tcsp );
rdepth = db_tree_counter( tp->tr_b.tb_right, tcsp );
if( ldepth > rdepth ) return ldepth;
return rdepth;
default:
bu_log("db_tree_counter: bad op %d\n", tp->tr_op);
bu_bomb("db_tree_counter\n");
/* NOTREACHED */
}
}
#define DB5COMB_TOKEN_LEAF 1
#define DB5COMB_TOKEN_UNION 2
#define DB5COMB_TOKEN_INTERSECT 3
#define DB5COMB_TOKEN_SUBTRACT 4
#define DB5COMB_TOKEN_XOR 5
#define DB5COMB_TOKEN_NOT 6
struct rt_comb_v5_serialize_state {
long magic;
long mat_num;
unsigned char *matp;
unsigned char *leafp;
unsigned char *exprp;
int wid;
};
#define RT_COMB_V5_SERIALIZE_STATE_MAGIC 0x43357373 /* C5ss */
#define RT_CK_COMB_V5_SERIALIZE_STATE(_p) BU_CKMAG(_p, RT_COMB_V5_SERIALIZE_STATE_MAGIC, "rt_comb_v5_serialize_state")
/*
* R T _ C O M B _ V 5 _ S E R I A L I Z E
*
* In one single pass through the tree, serialize out all three
* output sections at once.
*/
void
rt_comb_v5_serialize(
const union tree *tp,
struct rt_comb_v5_serialize_state *ssp)
{
int n;
RT_CK_TREE(tp);
RT_CK_COMB_V5_SERIALIZE_STATE(ssp);
switch( tp->tr_op ) {
case OP_DB_LEAF:
/*
* Encoding of the leaf:
* A null-terminated name string, and
* the matrix subscript. -1 == identity.
*/
n = strlen(tp->tr_l.tl_name) + 1;
bcopy( tp->tr_l.tl_name, ssp->leafp, n );
ssp->leafp += n;
if( tp->tr_l.tl_mat )
n = ssp->mat_num++;
else
n = -1;
ssp->leafp = db5_encode_length( ssp->leafp, n, ssp->wid );
/* Encoding of the matrix */
if( tp->tr_l.tl_mat ) {
htond( ssp->matp,
(const unsigned char *)tp->tr_l.tl_mat,
ELEMENTS_PER_MAT );
ssp->matp += ELEMENTS_PER_MAT * SIZEOF_NETWORK_DOUBLE;
}
/* Encoding of the "leaf" operator */
if( ssp->exprp )
*ssp->exprp++ = DB5COMB_TOKEN_LEAF;
return;
case OP_NOT:
/* Unary ops */
rt_comb_v5_serialize( tp->tr_b.tb_left, ssp );
if( ssp->exprp )
*ssp->exprp++ = DB5COMB_TOKEN_NOT;
return;
case OP_UNION:
/* This node is known to be a binary op */
rt_comb_v5_serialize( tp->tr_b.tb_left, ssp );
rt_comb_v5_serialize( tp->tr_b.tb_right, ssp );
if( ssp->exprp )
*ssp->exprp++ = DB5COMB_TOKEN_UNION;
return;
case OP_INTERSECT:
/* This node is known to be a binary op */
rt_comb_v5_serialize( tp->tr_b.tb_left, ssp );
rt_comb_v5_serialize( tp->tr_b.tb_right, ssp );
if( ssp->exprp )
*ssp->exprp++ = DB5COMB_TOKEN_INTERSECT;
return;
case OP_SUBTRACT:
/* This node is known to be a binary op */
rt_comb_v5_serialize( tp->tr_b.tb_left, ssp );
rt_comb_v5_serialize( tp->tr_b.tb_right, ssp );
if( ssp->exprp )
*ssp->exprp++ = DB5COMB_TOKEN_SUBTRACT;
return;
case OP_XOR:
/* This node is known to be a binary op */
rt_comb_v5_serialize( tp->tr_b.tb_left, ssp );
rt_comb_v5_serialize( tp->tr_b.tb_right, ssp );
if( ssp->exprp )
*ssp->exprp++ = DB5COMB_TOKEN_XOR;
return;
default:
bu_log("rt_comb_v5_serialize: bad op %d\n", tp->tr_op);
bu_bomb("rt_comb_v5_serialize\n");
}
}
/*
* R T _ C O M B _ E X P O R T 5
*/
int
rt_comb_export5( ep, ip, local2mm, dbip )
struct bu_external *ep;
CONST struct rt_db_internal *ip;
double local2mm;
CONST struct db_i *dbip;
{
struct rt_comb_internal *comb;
struct db_tree_counter_state tcs;
struct rt_comb_v5_serialize_state ss;
long max_stack_depth;
long need;
int rpn_len = 0; /* # items in RPN expression */
int wid;
unsigned char *cp;
unsigned char *leafp_end;
struct bu_attribute_value_set *avsp;
struct bu_vls value;
RT_CK_DB_INTERNAL( ip );
if( ip->idb_type != ID_COMBINATION ) bu_bomb("rt_comb_export5() type not ID_COMBINATION");
comb = (struct rt_comb_internal *)ip->idb_ptr;
RT_CK_COMB(comb);
/* First pass -- count number of non-identity matricies,
* number of leaf nodes, number of operator nodes.
*/
bzero( (char *)&tcs, sizeof(tcs) );
tcs.magic = DB_TREE_COUNTER_STATE_MAGIC;
max_stack_depth = db_tree_counter( comb->tree, &tcs );
if( tcs.non_union_seen ) {
/* RPN expression needs one byte for each leaf or operator node */
rpn_len = tcs.n_leaf + tcs.n_oper;
} else {
rpn_len = 0;
}
wid = db5_select_length_encoding(
tcs.n_mat | tcs.n_leaf | tcs.leafbytes |
rpn_len | max_stack_depth );
/* Apply correction factor to tcs.leafbytes now that we know 'wid'.
* Ignore the slight chance that a smaller 'wid' might now be possible.
*/
tcs.leafbytes -= tcs.n_leaf * (8 - db5_enc_len[wid]);
bu_log("wid=%d, n_max=%d, n_leaf=%d, n_oper=%d, leafbytes=%d, non_union_seen=%d, max_stack_depth=%d, rpn_len=%d\n",
wid, tcs.n_mat, tcs.n_leaf, tcs.n_oper, tcs.leafbytes, tcs.non_union_seen, max_stack_depth, rpn_len);
/* Second pass -- determine amount of on-disk storage needed */
need = 1 + /* width code */
db5_enc_len[wid] + /* size for nmatricies */
db5_enc_len[wid] + /* size for nleaves */
db5_enc_len[wid] + /* size for leafbytes */
db5_enc_len[wid] + /* size for len of RPN */
db5_enc_len[wid] + /* size for max_stack_depth */
tcs.n_mat * (ELEMENTS_PER_MAT * SIZEOF_NETWORK_DOUBLE) + /* sizeof matrix array */
tcs.leafbytes + /* size for leaf nodes */
rpn_len; /* storage for RPN expression */
BU_INIT_EXTERNAL(ep);
ep->ext_nbytes = need;
#if 0
ep->ext_buf = bu_malloc( need, "rt_comb_export5 ext_buf" );
#else
ep->ext_buf = bu_calloc( 1, need, "rt_comb_export5 ext_buf" );
#endif
/* Build combination's on-disk header section */
cp = (unsigned char *)ep->ext_buf;
*cp++ = wid;
cp = db5_encode_length( cp, tcs.n_mat, wid );
cp = db5_encode_length( cp, tcs.n_leaf, wid );
cp = db5_encode_length( cp, tcs.leafbytes, wid );
cp = db5_encode_length( cp, rpn_len, wid );
cp = db5_encode_length( cp, max_stack_depth, wid );
/*
* The output format has three sections:
* Section 1: matricies
* Section 2: leaf nodes
* Section 3: Optional RPN expression
*
* We have pre-computed the exact size of all three sections,
* so they can all be searialized together in one pass.
* Establish pointers to the start of each section.
*/
ss.magic = RT_COMB_V5_SERIALIZE_STATE_MAGIC;
ss.wid = wid;
ss.mat_num = 0;
ss.matp = cp;
ss.leafp = cp + tcs.n_mat * (ELEMENTS_PER_MAT * SIZEOF_NETWORK_DOUBLE);
leafp_end = ss.leafp + tcs.leafbytes;
if( rpn_len )
ss.exprp = leafp_end;
else
ss.exprp = NULL;
rt_comb_v5_serialize( comb->tree, &ss );
BU_ASSERT_LONG( ss.mat_num, ==, tcs.n_mat );
BU_ASSERT_PTR( ss.matp, ==, cp + tcs.n_mat * (ELEMENTS_PER_MAT * SIZEOF_NETWORK_DOUBLE) );
BU_ASSERT_PTR( ss.leafp, ==, leafp_end );
if( rpn_len )
BU_ASSERT_PTR( ss.exprp, <=, ((unsigned char *)ep->ext_buf) + ep->ext_nbytes );
/* Encode all the other stuff as attributes. */
bu_vls_init( &value );
/* WARNING: We remove const from the ip pointer!!! */
avsp = (struct bu_attribute_value_set *)&ip->idb_avs;
if( avsp->magic != BU_AVS_MAGIC )
bu_avs_init( avsp, 32, "rt_comb v5 attributes" );
if( comb->region_flag ) {
/* Presence of this attribute means this comb is a region. */
/* Current code values are 0, 1, and 2; all are regions. */
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%d", comb->is_fastgen );
bu_avs_add_vls( avsp, "region", &value );
}
if( comb->inherit )
bu_avs_add( avsp, "inherit", "1" );
if( comb->rgb_valid ) {
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%d/%d/%d", V3ARGS(comb->rgb) );
bu_avs_add_vls( avsp, "rgb", &value );
}
/* optical shader string goes out in Tcl format */
if( bu_vls_strlen( &comb->shader ) > 0 )
bu_avs_add_vls( avsp, "oshader", &comb->shader );
if( bu_vls_strlen( &comb->material ) > 0 )
bu_avs_add_vls( avsp, "material", &comb->material );
if( comb->temperature > 0 ) {
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%f", comb->temperature );
bu_avs_add_vls( avsp, "temp", &value );
}
/* GIFT compatability */
if( comb->region_id != 0 ) {
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%d", comb->region_id );
bu_avs_add_vls( avsp, "region_id", &value );
}
if( comb->aircode != 0 ) {
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%d", comb->aircode );
bu_avs_add_vls( avsp, "aircode", &value );
}
if( comb->GIFTmater != 0 ) {
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%d", comb->GIFTmater );
bu_avs_add_vls( avsp, "giftmater", &value );
}
if( comb->los != 0 ) {
bu_vls_trunc( &value, 0 );
bu_vls_printf( &value, "%d", comb->los );
bu_avs_add_vls( avsp, "los", &value );
}
if(getuid()==53)bu_avs_print( avsp, "comb v5 attributes");
bu_vls_free( &value );
return 0; /* OK */
}
/*
* R T _ C O M B _ I M P O R T 5
*
* Read a combination object in v5 external (on-disk) format,
* and convert it into the internal format described in h/rtgeom.h
*
* This is an unusual conversion, because some of the data is taken
* from attributes, not just from the object body.
* By the time this is called, the attributes will already have been
* cracked into ip->idb_avs, we get the attributes from there.
*
* Returns -
* 0 OK
* -1 FAIL
*/
int
rt_comb_import5(ip, ep, mat, dbip)
struct rt_db_internal *ip;
const struct bu_external *ep;
const mat_t mat;
const struct db_i *dbip;
{
struct rt_comb_internal *comb;
unsigned char *cp;
int wid;
long nmat, nleaf, rpn_len, max_stack_depth;
long leafbytes;
unsigned char *matp;
unsigned char *leafp;
unsigned char *leafp_end;
unsigned char *exprp;
#define MAX_V5_STACK 8000
union tree *stack[MAX_V5_STACK];
union tree **sp; /* stack pointer */
const char *ap;
int i;
RT_CK_DB_INTERNAL( ip );
BU_CK_EXTERNAL(ep);
ip->idb_type = ID_COMBINATION;
ip->idb_meth = &rt_functab[ID_COMBINATION];
BU_GETSTRUCT( comb, rt_comb_internal );
ip->idb_ptr = (genptr_t)comb;
comb->magic = RT_COMB_MAGIC;
bu_vls_init( &comb->shader );
bu_vls_init( &comb->material );
comb->temperature = -1;
cp = ep->ext_buf;
wid = *cp++;
cp += db5_decode_length( &nmat, cp, wid );
cp += db5_decode_length( &nleaf, cp, wid );
cp += db5_decode_length( &leafbytes, cp, wid );
cp += db5_decode_length( &rpn_len, cp, wid );
cp += db5_decode_length( &max_stack_depth, cp, wid );
matp = cp;
leafp = cp + nmat * (ELEMENTS_PER_MAT * SIZEOF_NETWORK_DOUBLE);
exprp = leafp + leafbytes;
leafp_end = exprp;
bu_log("nmat=%d, nleaf=%d, rpn_len=%d, max_stack_depth=%d\n", nmat, nleaf, rpn_len, max_stack_depth);
if( rpn_len == 0 ) {
int i;
for( i = nleaf-1; i >= 0; i-- ) {
union tree *tp;
int mi;
BU_GETUNION( tp, tree );
tp->tr_l.magic = RT_TREE_MAGIC;
tp->tr_l.tl_op = OP_DB_LEAF;
tp->tr_l.tl_name = bu_strdup( (const char *)leafp );
leafp += strlen( (const char *)leafp) + 1;
/* Get matrix index */
leafp += db5_decode_signed( &mi, leafp, wid );
if( mi < 0 ) {
/* Signal identity matrix */
tp->tr_l.tl_mat = NULL;
} else {
/* Unpack indicated matrix mi */
BU_ASSERT_LONG( mi, <, nmat );
tp->tr_l.tl_mat = (matp_t)bu_malloc(
sizeof(mat_t), "v5comb mat");
ntohd( (unsigned char *)tp->tr_l.tl_mat,
&matp[mi*ELEMENTS_PER_MAT*SIZEOF_NETWORK_DOUBLE],
ELEMENTS_PER_MAT);
}
if( comb->tree == TREE_NULL ) {
comb->tree = tp;
} else {
union tree *unionp;
BU_GETUNION( unionp, tree );
unionp->tr_b.magic = RT_TREE_MAGIC;
unionp->tr_b.tb_op = OP_UNION;
unionp->tr_b.tb_left = comb->tree;
unionp->tr_b.tb_right = tp;
comb->tree = unionp;
}
}
BU_ASSERT_PTR( leafp, ==, leafp_end );
goto finish;
}
/*
* Bring the RPN expression back from the disk,
* populating leaves and matricies in the order they are encountered.
*/
if( max_stack_depth > MAX_V5_STACK ) {
bu_log("Combination needs stack depth %d, only have %d, aborted\n",
max_stack_depth, MAX_V5_STACK);
return -1;
}
sp = &stack[0];
for( i=0; i < rpn_len; i++,exprp++ ) {
union tree *tp;
int mi;
BU_GETUNION( tp, tree );
tp->tr_b.magic = RT_TREE_MAGIC;
switch( *exprp ) {
case DB5COMB_TOKEN_LEAF:
tp->tr_l.tl_op = OP_DB_LEAF;
tp->tr_l.tl_name = bu_strdup( (const char *)leafp );
leafp += strlen( (const char *)leafp) + 1;
/* Get matrix index */
mi = bu_glong( leafp );
leafp += 4;
if( mi < 0 ) {
/* Signal identity matrix */
tp->tr_l.tl_mat = NULL;
} else {
/* Unpack indicated matrix mi */
BU_ASSERT_LONG( mi, <, nmat );
tp->tr_l.tl_mat = (matp_t)bu_malloc(
sizeof(mat_t), "v5comb mat");
ntohd( (unsigned char *)tp->tr_l.tl_mat,
&matp[mi*ELEMENTS_PER_MAT*SIZEOF_NETWORK_DOUBLE],
ELEMENTS_PER_MAT);
}
break;
case DB5COMB_TOKEN_UNION:
case DB5COMB_TOKEN_INTERSECT:
case DB5COMB_TOKEN_SUBTRACT:
case DB5COMB_TOKEN_XOR:
/* These are all binary operators */
tp->tr_b.tb_regionp = REGION_NULL;
tp->tr_b.tb_right = *--sp;
RT_CK_TREE(tp->tr_b.tb_right);
tp->tr_b.tb_left = *--sp;
RT_CK_TREE(tp->tr_b.tb_left);
switch( *exprp ) {
case DB5COMB_TOKEN_UNION:
tp->tr_b.tb_op = OP_UNION;
break;
case DB5COMB_TOKEN_INTERSECT:
tp->tr_b.tb_op = OP_INTERSECT;
break;
case DB5COMB_TOKEN_SUBTRACT:
tp->tr_b.tb_op = OP_SUBTRACT;
break;
case DB5COMB_TOKEN_XOR:
tp->tr_b.tb_op = OP_XOR;
break;
}
break;
case DB5COMB_TOKEN_NOT:
/* This is a unary operator */
tp->tr_b.tb_regionp = REGION_NULL;
tp->tr_b.tb_left = *--sp;
RT_CK_TREE(tp->tr_b.tb_left);
tp->tr_b.tb_right = TREE_NULL;
tp->tr_b.tb_op = OP_NOT;
break;
default:
bu_log("rt_comb_import5() unknown RPN expression token=%d, import aborted\n", *exprp);
return -1;
}
/* Push this node on the stack */
*sp++ = tp;
}
BU_ASSERT_PTR( leafp, ==, leafp_end );
/* There should only be one thing left on the stack, the result */
BU_ASSERT_PTR( sp, ==, &stack[1] );
comb->tree = stack[0];
RT_CK_TREE(comb->tree);
finish:
if( ip->idb_avs.magic != BU_AVS_MAGIC ) return 0; /* OK */
if(getuid()==53) bu_avs_print( &ip->idb_avs, "comb5" );
/* Unpack the attributes */
if( (ap = bu_avs_get( &ip->idb_avs, "rgb" )) != NULL ) {
int ibuf[3];
if( sscanf( ap, "%d/%d/%d", ibuf, ibuf+1, ibuf+2 ) == 3 ) {
VMOVE( comb->rgb, ibuf );
comb->rgb_valid = 1;
} else {
bu_log("unable to parse 'rgb' attribute '%s'\n", ap);
}
}
if( (ap = bu_avs_get( &ip->idb_avs, "region" )) != NULL ) {
int ibuf[1];
if( sscanf( ap, "%d", ibuf ) == 1 ) {
/* Presence of this attribute implies it is a region */
comb->region_flag = 1;
/* Value of this parameter is the FASTGEN code */
comb->is_fastgen = ibuf[0];
} else {
bu_log("unable to parse 'region' attribute '%s'\n", ap);
}
}
if( (ap = bu_avs_get( &ip->idb_avs, "oshader" )) != NULL ) {
bu_vls_strcat( &comb->shader, ap );
}
return 0; /* OK */
}
-1075
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More