void process_cmd(char *buf) { char *cp; char *sp; char *ep; int len; extern struct command_tab rt_cmdtab[]; /* from do.c */ /* Parse the string */ len = strlen(buf); ep = buf+len; sp = buf; cp = buf; while (sp < ep) { /* Find next semi-colon */ while (*cp && *cp != ';') cp++; *cp++ = '\0'; /* Process this command */ if (debug) bu_log("process_cmd '%s'\n", sp); if (rt_do_cmd(APP.a_rt_i, sp, rt_cmdtab) < 0) bu_exit(1, "process_cmd: error on '%s'\n", sp); sp = cp; } }
int main(int argc, char **argv) { char *buf; int ret; if (argc != 1 || isatty(fileno(stdin))) { fprintf(stderr, "Usage: %s < script > table\n", argv[0]); return 1; } /* * New way - command driven. * Process sequence of input commands. * All the work happens in the functions * called by rt_do_cmd(). */ while ((buf = rt_read_cmd(stdin)) != (char *)0) { ret = rt_do_cmd(NULL, buf, rt_cmdtab); if (ret < 0) { bu_log("Command failure on '%s'\n", buf); bu_free(buf, "cmd buf"); break; } bu_free(buf, "cmd buf"); } return 0; }
/* * M A I N */ int main(int argc, char **argv) { struct rt_i *rtip = NULL; char *title_file = NULL, *title_obj = NULL; /* name of file and first object */ char idbuf[RT_BUFSIZE] = {0}; /* First ID record info */ void application_init(); struct bu_vls times; int i; #if defined(_WIN32) && !defined(__CYGWIN__) setmode(fileno(stdin), O_BINARY); setmode(fileno(stdout), O_BINARY); setmode(fileno(stderr), O_BINARY); #else bu_setlinebuf( stdout ); bu_setlinebuf( stderr ); #endif #ifdef HAVE_SBRK beginptr = (char *) sbrk(0); #endif azimuth = 35.0; /* GIFT defaults */ elevation = 25.0; AmbientIntensity=0.4; background[0] = background[1] = 0.0; background[2] = 1.0/255.0; /* slightly non-black */ /* Before option processing, get default number of processors */ npsw = bu_avail_cpus(); /* Use all that are present */ if ( npsw > MAX_PSW ) npsw = MAX_PSW; /* Before option processing, do application-specific initialization */ RT_APPLICATION_INIT( &ap ); application_init(); /* Process command line options */ if ( !get_args( argc, argv ) ) { (void)fputs(usage, stderr); return 1; } /* Identify the versions of the libraries we are using. */ if (rt_verbosity & VERBOSE_LIBVERSIONS) { (void)fprintf(stderr, "%s%s%s%s\n", brlcad_ident(title), rt_version(), bn_version(), bu_version() ); } #if defined(DEBUG) (void)fprintf(stderr, "Compile-time debug symbols are available\n"); #endif #if defined(NO_BOMBING_MACROS) || defined(NO_MAGIC_CHECKING) || defined(NO_BADRAY_CECHKING) || defined(NO_DEBUG_CHECKING) (void)fprintf(stderr, "WARNING: Run-time debugging is disabled and may enhance performance\n"); #endif /* Identify what host we're running on */ if (rt_verbosity & VERBOSE_LIBVERSIONS) { char hostname[512] = {0}; #ifndef _WIN32 if ( gethostname( hostname, sizeof(hostname) ) >= 0 && hostname[0] != '\0' ) (void)fprintf(stderr, "Running on %s\n", hostname); #else sprintf(hostname, "Microsoft Windows"); (void)fprintf(stderr, "Running on %s\n", hostname); #endif } if ( bu_optind >= argc ) { fprintf(stderr, "%s: MGED database not specified\n", argv[0]); (void)fputs(usage, stderr); return 1; } if (rpt_overlap) ap.a_logoverlap = ((void (*)())0); else ap.a_logoverlap = rt_silent_logoverlap; /* If user gave no sizing info at all, use 512 as default */ if ( width <= 0 && cell_width <= 0 ) width = 512; if ( height <= 0 && cell_height <= 0 ) height = 512; /* If user didn't provide an aspect ratio, use the image * dimensions ratio as a default. */ if (aspect <= 0.0) { aspect = (fastf_t)width / (fastf_t)height; } if ( sub_grid_mode ) { /* check that we have a legal subgrid */ if ( sub_xmax >= width || sub_ymax >= height ) { fprintf( stderr, "rt: illegal values for subgrid %d,%d,%d,%d\n", sub_xmin, sub_ymin, sub_xmax, sub_ymax ); fprintf( stderr, "\tFor a %d X %d image, the subgrid must be within 0, 0,%d,%d\n", width, height, width-1, height-1 ); return 1; } } if ( incr_mode ) { int x = height; if ( x < width ) x = width; incr_nlevel = 1; while ( (1<<incr_nlevel) < x ) incr_nlevel++; height = width = 1<<incr_nlevel; if (rt_verbosity & VERBOSE_INCREMENTAL) fprintf(stderr, "incremental resolution, nlevels = %d, width=%d\n", incr_nlevel, width); } /* * Handle parallel initialization, if applicable. */ #ifndef PARALLEL npsw = 1; /* force serial */ #endif if ( npsw < 0 ) { /* Negative number means "all but" npsw */ npsw = bu_avail_cpus() + npsw; } /* allow debug builds to go higher than the max */ if (!(bu_debug & BU_DEBUG_PARALLEL)) { if ( npsw > MAX_PSW ) { npsw = MAX_PSW; } } if (npsw > 1) { rt_g.rtg_parallel = 1; if (rt_verbosity & VERBOSE_MULTICPU) fprintf(stderr, "Planning to run with %d processors\n", npsw ); } else { rt_g.rtg_parallel = 0; } /* Initialize parallel processor support */ bu_semaphore_init( RT_SEM_LAST ); /* * Do not use bu_log() or bu_malloc() before this point! */ if ( bu_debug ) { bu_printb( "libbu bu_debug", bu_debug, BU_DEBUG_FORMAT ); bu_log("\n"); } if ( RT_G_DEBUG ) { bu_printb( "librt rt_g.debug", rt_g.debug, DEBUG_FORMAT ); bu_log("\n"); } if ( rdebug ) { bu_printb( "rt rdebug", rdebug, RDEBUG_FORMAT ); bu_log("\n"); } /* We need this to run rt_dirbuild */ rt_init_resource( &rt_uniresource, MAX_PSW, NULL ); bn_rand_init( rt_uniresource.re_randptr, 0 ); title_file = argv[bu_optind]; title_obj = argv[bu_optind+1]; nobjs = argc - bu_optind - 1; objtab = &(argv[bu_optind+1]); if ( nobjs <= 0 ) { bu_log("%s: no objects specified -- raytrace aborted\n", argv[0]); return 1; } /* Echo back the command line arugments as given, in 3 Tcl commands */ if (rt_verbosity & VERBOSE_MODELTITLE) { struct bu_vls str; bu_vls_init(&str); bu_vls_from_argv( &str, bu_optind, (const char **)argv ); bu_vls_strcat( &str, "\nopendb " ); bu_vls_strcat( &str, title_file ); bu_vls_strcat( &str, ";\ntree " ); bu_vls_from_argv( &str, nobjs <= 16 ? nobjs : 16, (const char **)argv+bu_optind+1 ); if ( nobjs > 16 ) bu_vls_strcat( &str, " ..."); else bu_vls_putc( &str, ';' ); bu_log("%s\n", bu_vls_addr(&str) ); bu_vls_free(&str); } /* Build directory of GED database */ bu_vls_init( × ); rt_prep_timer(); if ( (rtip=rt_dirbuild(title_file, idbuf, sizeof(idbuf))) == RTI_NULL ) { bu_log("rt: rt_dirbuild(%s) failure\n", title_file); return 2; } ap.a_rt_i = rtip; (void)rt_get_timer( ×, NULL ); if (rt_verbosity & VERBOSE_MODELTITLE) bu_log("db title: %s\n", idbuf); if (rt_verbosity & VERBOSE_STATS) bu_log("DIRBUILD: %s\n", bu_vls_addr(×) ); bu_vls_free( × ); memory_summary(); /* Copy values from command line options into rtip */ rtip->rti_space_partition = space_partition; rtip->rti_nugrid_dimlimit = nugrid_dimlimit; rtip->rti_nu_gfactor = nu_gfactor; rtip->useair = use_air; rtip->rti_save_overlaps = save_overlaps; if ( rt_dist_tol > 0 ) { rtip->rti_tol.dist = rt_dist_tol; rtip->rti_tol.dist_sq = rt_dist_tol * rt_dist_tol; } if ( rt_perp_tol > 0 ) { rtip->rti_tol.perp = rt_perp_tol; rtip->rti_tol.para = 1 - rt_perp_tol; } if (rt_verbosity & VERBOSE_TOLERANCE) rt_pr_tol( &rtip->rti_tol ); /* before view_init */ if ( outputfile && strcmp( outputfile, "-") == 0 ) outputfile = (char *)0; /* * Initialize application. * Note that width & height may not have been set yet, * since they may change from frame to frame. */ if ( view_init( &ap, title_file, title_obj, outputfile!=(char *)0, framebuffer!=(char *)0 ) != 0 ) { /* Framebuffer is desired */ register int xx, yy; int zoom; /* Ask for a fb big enough to hold the image, at least 512. */ /* This is so MGED-invoked "postage stamps" get zoomed up big enough to see */ xx = yy = 512; if ( width > xx || height > yy ) { xx = width; yy = height; } bu_semaphore_acquire( BU_SEM_SYSCALL ); fbp = fb_open( framebuffer, xx, yy ); bu_semaphore_release( BU_SEM_SYSCALL ); if ( fbp == FBIO_NULL ) { fprintf(stderr, "rt: can't open frame buffer\n"); return 12; } bu_semaphore_acquire( BU_SEM_SYSCALL ); /* If fb came out smaller than requested, do less work */ if ( fb_getwidth(fbp) < width ) width = fb_getwidth(fbp); if ( fb_getheight(fbp) < height ) height = fb_getheight(fbp); /* If the fb is lots bigger (>= 2X), zoom up & center */ if ( width > 0 && height > 0 ) { zoom = fb_getwidth(fbp)/width; if ( fb_getheight(fbp)/height < zoom ) zoom = fb_getheight(fbp)/height; } else { zoom = 1; } (void)fb_view( fbp, width/2, height/2, zoom, zoom ); bu_semaphore_release( BU_SEM_SYSCALL ); } if ( (outputfile == (char *)0) && (fbp == FBIO_NULL) ) { /* If not going to framebuffer, or to a file, then use stdout */ if ( outfp == NULL ) outfp = stdout; /* output_is_binary is changed by view_init, as appropriate */ if ( output_is_binary && isatty(fileno(outfp)) ) { fprintf(stderr, "rt: attempting to send binary output to terminal, aborting\n"); return 14; } } /* * Initialize all the per-CPU memory resources. * The number of processors can change at runtime, init them all. */ for ( i=0; i < MAX_PSW; i++ ) { rt_init_resource( &resource[i], i, rtip ); bn_rand_init( resource[i].re_randptr, i ); } memory_summary(); #ifdef SIGUSR1 (void)signal( SIGUSR1, siginfo_handler ); #endif #ifdef SIGINFO (void)signal( SIGINFO, siginfo_handler ); #endif if ( !matflag ) { int frame_retval; def_tree( rtip ); /* Load the default trees */ do_ae( azimuth, elevation ); frame_retval = do_frame( curframe ); if (frame_retval != 0) { /* Release the framebuffer, if any */ if ( fbp != FBIO_NULL ) { fb_close(fbp); } return 1; } } else if ( !isatty(fileno(stdin)) && old_way( stdin ) ) { ; /* All is done */ } else { register char *buf; register int ret; /* * New way - command driven. * Process sequence of input commands. * All the work happens in the functions * called by rt_do_cmd(). */ while ( (buf = rt_read_cmd( stdin )) != (char *)0 ) { if ( R_DEBUG&RDEBUG_PARSE ) fprintf(stderr, "cmd: %s\n", buf ); ret = rt_do_cmd( rtip, buf, rt_cmdtab ); bu_free( buf, "rt_read_cmd command buffer" ); if ( ret < 0 ) break; } if ( curframe < desiredframe ) { fprintf(stderr, "rt: Desired frame %d not reached, last was %d\n", desiredframe, curframe); } } /* Release the framebuffer, if any */ if (fbp != FBIO_NULL) { fb_close(fbp); } return(0); }
/* * G E T _ A R G S */ int get_args( int argc, register char **argv ) { register int c; register int i; bu_optind = 1; /* restart */ #define GETOPT_STR \ ".:,:@:a:b:c:d:e:f:g:h:ij:k:l:n:o:p:q:rs:tu:v:w:x:A:BC:D:E:F:G:H:IJ:K:MN:O:P:Q:RST:U:V:WX:!:+:" while ( (c=bu_getopt( argc, argv, GETOPT_STR )) != EOF ) { switch ( c ) { case 'q': i = atoi(bu_optarg); if (i <= 0) { bu_exit(EXIT_FAILURE, "-q %d is < 0\n", i); } if ( i > BN_RANDHALFTABSIZE) { bu_exit(EXIT_FAILURE, "-q %d is > maximum (%d)\n", i, BN_RANDHALFTABSIZE); } bn_randhalftabsize = i; break; case 'h': i = sscanf(bu_optarg, "%lg,%lg,%lg,%lg", &airdensity, &haze[X], &haze[Y], &haze[Z]); break; case 't': transpose_grid = 1; break; case 'j': { register char *cp = bu_optarg; sub_xmin = atoi(cp); while ( (*cp >= '0' && *cp <= '9') ) cp++; while ( *cp && (*cp < '0' || *cp > '9') ) cp++; sub_ymin = atoi(cp); while ( (*cp >= '0' && *cp <= '9') ) cp++; while ( *cp && (*cp < '0' || *cp > '9') ) cp++; sub_xmax = atoi(cp); while ( (*cp >= '0' && *cp <= '9') ) cp++; while ( *cp && (*cp < '0' || *cp > '9') ) cp++; sub_ymax = atoi(cp); bu_log("Sub-rectangle: (%d,%d) (%d,%d)\n", sub_xmin, sub_ymin, sub_xmax, sub_ymax ); if ( sub_xmin >= 0 && sub_xmin < sub_xmax && sub_ymin >= 0 && sub_ymin < sub_ymax ) { sub_grid_mode = 1; } else { sub_grid_mode = 0; bu_log("WARNING: bad sub-rectangle, ignored\n"); } } break; case 'k': /* define cutting plane */ { fastf_t f; do_kut_plane = 1; i = sscanf(bu_optarg, "%lg,%lg,%lg,%lg", &kut_plane[X], &kut_plane[Y], &kut_plane[Z], &kut_plane[H]); if( i != 4 ) { bu_exit( EXIT_FAILURE, "ERROR: bad cutting plane\n" ); } /* verify that normal has unit length */ f = MAGNITUDE( kut_plane ); if( f <= SMALL ) { bu_exit( EXIT_FAILURE, "Bad normal for cutting plane, length=%g\n", f ); } f = 1.0 /f; VSCALE( kut_plane, kut_plane, f ); kut_plane[3] *= f; break; } case '.': nu_gfactor = (double)atof( bu_optarg ); break; case ',': space_partition = atoi(bu_optarg); break; case '@': nugrid_dimlimit = atoi(bu_optarg); break; case 'c': (void)rt_do_cmd( (struct rt_i *)0, bu_optarg, rt_cmdtab ); break; case 'C': { char buf[128] = {0}; int r, g, b; register char *cp = bu_optarg; r = atoi(cp); while ( (*cp >= '0' && *cp <= '9') ) cp++; while ( *cp && (*cp < '0' || *cp > '9') ) cp++; g = atoi(cp); while ( (*cp >= '0' && *cp <= '9') ) cp++; while ( *cp && (*cp < '0' || *cp > '9') ) cp++; b = atoi(cp); if ( r < 0 || r > 255 ) r = 255; if ( g < 0 || g > 255 ) g = 255; if ( b < 0 || b > 255 ) b = 255; #if defined(_WIN32) if (r == 0) background[0] = 0.0; else background[0] = r / 255.0; if (g == 0) background[1] = 0.0; else background[1] = g / 255.0; if (b == 0) background[2] = 0.0; else background[2] = b / 255.0; #else sprintf(buf, "set background=%f/%f/%f", r/255., g/255., b/255. ); (void)rt_do_cmd( (struct rt_i *)0, buf, rt_cmdtab ); #endif } break; case 'T': { double f; char *cp; f = 0; if ( sscanf( bu_optarg, "%lf", &f ) == 1 ) { if ( f > 0 ) rt_dist_tol = f; } f = 0; if ( (cp = strchr(bu_optarg, '/')) || (cp = strchr(bu_optarg, ',')) ) { if ( sscanf( cp+1, "%lf", &f ) == 1 ) { if ( f > 0 && f < 1 ) rt_perp_tol = f; } } bu_log("Using tolerance %lg", f); break; } case 'U': use_air = atoi( bu_optarg ); break; case 'I': interactive = 1; break; case 'i': incr_mode = 1; break; case 'S': stereo = 1; break; case 'J': sscanf( bu_optarg, "%x", &jitter ); break; case 'H': hypersample = atoi( bu_optarg ); if ( hypersample > 0 ) jitter = 1; break; case 'F': framebuffer = bu_optarg; break; case 'D': desiredframe = atoi( bu_optarg ); break; case 'K': finalframe = atoi( bu_optarg ); break; case 'N': sscanf( bu_optarg, "%x", (unsigned int *)&rt_g.NMG_debug); bu_log("NMG_debug=0x%x\n", rt_g.NMG_debug); break; case 'M': matflag = 1; break; case 'A': AmbientIntensity = atof( bu_optarg ); break; case 'x': sscanf( bu_optarg, "%x", (unsigned int *)&rt_g.debug ); break; case 'X': sscanf( bu_optarg, "%x", (unsigned int *)&rdebug ); break; case '!': sscanf( bu_optarg, "%x", (unsigned int *)&bu_debug ); break; case 's': /* Square size */ i = atoi( bu_optarg ); if ( i < 2 || i > MAX_WIDTH ) fprintf(stderr, "squaresize=%d out of range\n", i); else width = height = i; break; case 'n': i = atoi( bu_optarg ); if ( i < 2 || i > MAX_WIDTH ) fprintf(stderr, "height=%d out of range\n", i); else height = i; break; case 'W': (void)rt_do_cmd( (struct rt_i *)0, "set background=1.0/1.0/1.0", rt_cmdtab ); default_background = 0; break; case 'w': i = atoi( bu_optarg ); if ( i < 2 || i > MAX_WIDTH ) fprintf(stderr, "width=%d out of range\n", i); else width = i; break; case 'g': cell_width = atof( bu_optarg ); cell_newsize = 1; break; case 'G': cell_height = atof( bu_optarg ); cell_newsize = 1; break; case 'a': /* Set azimuth */ azimuth = atof( bu_optarg ); matflag = 0; break; case 'e': /* Set elevation */ elevation = atof( bu_optarg ); matflag = 0; break; case 'l': { char *item; /* Select lighting model # */ lightmodel= 1; /* Initialize with Full Lighting Model */ item= strtok(bu_optarg, ","); lightmodel= atoi(item); if (lightmodel == 7) { /* Process the photon mapping arguments */ item= strtok(NULL, ","); pmargs[0]= item ? atoi(item) : 16384; /* Number of Global Photons */ item= strtok(NULL, ","); pmargs[1]= item ? atof(item) : 50; /* Percent of Global Photons that should be used for Caustic Photons */ item= strtok(NULL, ","); pmargs[2]= item ? atoi(item) : 10; /* Number of Irradiance Sample Rays, Total Rays is this number squared */ item= strtok(NULL, ","); pmargs[3]= item ? atof(item) : 60.0; /* Angular Tolerance */ item= strtok(NULL, ","); pmargs[4]= item ? atoi(item) : 0; /* Random Seed */ item= strtok(NULL, ","); pmargs[5]= item ? atoi(item) : 0; /* Importance Mapping */ item= strtok(NULL, ","); pmargs[6]= item ? atoi(item) : 0; /* Irradiance Hypersampling */ item= strtok(NULL, ","); pmargs[7]= item ? atoi(item) : 0; /* Visualize Irradiance */ item= strtok(NULL, ","); pmargs[8]= item ? atof(item) : 1.0; /* Scale Lumens */ item= strtok(NULL,","); if (item) { bu_strlcpy(pmfile, item, sizeof(pmfile)); } else { pmfile[0]= 0; } } } break; case 'O': /* Output pixel file name, double precision format */ outputfile = bu_optarg; doubles_out = 1; break; case 'o': /* Output pixel file name, unsigned char format */ outputfile = bu_optarg; doubles_out = 0; break; case 'p': rt_perspective = atof( bu_optarg ); if ( rt_perspective < 0 || rt_perspective > 179 ) { fprintf(stderr, "persp=%g out of range\n", rt_perspective); rt_perspective = 0; } break; case 'u': units = bu_units_conversion(bu_optarg); if (units <= 0.0) { units = 1.0; bu_log("WARNING: bad units, using default (%s)\n", bu_units_string(units)); } break; case 'v': /* Set level of "non-debug" debugging output */ sscanf( bu_optarg, "%x", (unsigned int *)&rt_verbosity ); bu_printb( "Verbosity:", rt_verbosity, VERBOSE_FORMAT); bu_log("\n"); break; case 'E': eye_backoff = atof( bu_optarg ); break; case 'P': { /* Number of parallel workers */ int avail_cpus; avail_cpus = bu_avail_cpus(); npsw = atoi( bu_optarg ); if (npsw > avail_cpus ) { fprintf( stderr, "Requesting %d cpus, only %d available.", npsw, avail_cpus ); if ((bu_debug & BU_DEBUG_PARALLEL) || (RT_G_DEBUG & DEBUG_PARALLEL)) { fprintf(stderr, "\nAllowing surplus cpus due to debug flag.\n"); } else { fprintf( stderr, " Will use %d.\n", avail_cpus ); npsw = avail_cpus; } } if ( npsw == 0 || npsw < -MAX_PSW || npsw > MAX_PSW ) { fprintf(stderr, "Numer of requested cpus (%d) is out of range 1..%d", npsw, MAX_PSW); if ((bu_debug & BU_DEBUG_PARALLEL) || (RT_G_DEBUG & DEBUG_PARALLEL)) { fprintf(stderr, ", but allowing due to debug flag\n"); } else { fprintf(stderr, ", using -P1\n"); npsw = 1; } } } break; case 'Q': Query_one_pixel = ! Query_one_pixel; sscanf(bu_optarg, "%d,%d\n", &query_x, &query_y); break; case 'B': /* Remove all intentional random effects * (dither, etc) for benchmarking purposes. */ benchmark = 1; bn_mathtab_constant(); break; case 'b': /* Specify a single pixel to be done */ /* Actually processed in do_frame() */ string_pix_start = bu_optarg; npsw = 1; /* Cancel running in parallel */ break; case 'f': /* set expected playback rate in frames-per-second. * This actually gets stored as the delta-t per frame. */ if ( (frame_delta_t=atof( bu_optarg )) == 0.0) { fprintf(stderr, "Invalid frames/sec (%s) == 0.0\n", bu_optarg); frame_delta_t = 30.0; } frame_delta_t = 1.0 / frame_delta_t; break; case 'V': { /* View aspect */ fastf_t xx, yy; register char *cp = bu_optarg; xx = atof(cp); while ( (*cp >= '0' && *cp <= '9') || *cp == '.' ) cp++; while ( *cp && (*cp < '0' || *cp > '9') ) cp++; yy = atof(cp); if ( yy == 0 ) aspect = xx; else aspect = xx/yy; if ( aspect <= 0.0 ) { fprintf(stderr, "Bogus aspect %g, using 1.0\n", aspect); aspect = 1.0; } } break; case 'r': /* report overlapping region names */ rpt_overlap = 1; break; case 'R': /* DON'T report overlapping region names */ rpt_overlap = 0; break; case 'd': rpt_dist = atoi( bu_optarg ); break; case '+': { register char *cp = bu_optarg; switch (*cp) { case 't': output_is_binary = 0; break; default: fprintf(stderr, "ERROR: unknown option %c\n", *cp); return(0); /* BAD */ } } break; case EOF: fprintf(stderr, "ERROR: unknown option %c\n", c); return(0); /* BAD */ default: /* '?' */ fprintf(stderr, "ERROR: bad option specified\n"); return(0); /* BAD */ } } /* sanity checks for sane values */ if ( aspect <= 0.0 ) { aspect = 1.0; } /* Compat */ if (RT_G_DEBUG || R_DEBUG || rt_g.NMG_debug ) bu_debug |= BU_DEBUG_COREDUMP; if (RT_G_DEBUG & DEBUG_MEM_FULL) bu_debug |= BU_DEBUG_MEM_CHECK; if (RT_G_DEBUG & DEBUG_MEM) bu_debug |= BU_DEBUG_MEM_LOG; if (RT_G_DEBUG & DEBUG_PARALLEL) bu_debug |= BU_DEBUG_PARALLEL; if (RT_G_DEBUG & DEBUG_MATH) bu_debug |= BU_DEBUG_MATH; if (R_DEBUG & RDEBUG_RTMEM_END) bu_debug |= BU_DEBUG_MEM_CHECK; return(1); /* OK */ }