int
main(int argc, char **argv)
{
    static long ncells;

    bu_debug = BU_DEBUG_MEM_CHECK | BU_DEBUG_MEM_LOG;
    bu_debug = 0;

    BU_LIST_INIT(&(gp_locs.l));
    if (! pars_Argv(argc, argv)) {
	prnt_Usage();
	return 1;
    }
    grid = (Cell *) bu_malloc(sizeof(Cell) * maxcells, "grid");
    if (debug_flag & CFB_DBG_MEM)
	bu_log("grid = %p... %ld cells @ %lu bytes/cell\n",
	       (void *)grid, maxcells, sizeof(Cell));
    do {
	struct locrec *lrp;

	init_Globs();
	if ((ncells = read_Cell_Data()) == 0) {
	    bu_log("cell-fb: failed to read view\n");
	    return 1;
	}
	if (BU_LIST_NON_EMPTY(&(gp_locs.l))) {
	    while (BU_LIST_WHILE(lrp, locrec, (&(gp_locs.l)))) {
		BU_LIST_DEQUEUE(&(lrp->l));
		bu_log("%g %g	%d %d\n", lrp->h, lrp->v,
		       (int) H2SCRX(lrp->h), (int) V2SCRY(lrp->v));
		bu_free((char *) lrp, "location record");
	    }
	} else {
	    bu_log("Displaying %ld cells\n", ncells);
	    if (! display_Cells(ncells)) {
		bu_log("cell-fb: failed to display %ld cells\n", ncells);
		return 1;
	    }
	    if (log_flag)
		log_Run();
	}
    } while ((view_flag == 0) && ! feof(filep) && get_OK());

    return 0;
}
Example #2
0
File: lgt.c Project: kanzure/brlcad
int
main(int argc, char **argv)
{
    int i;

    bu_setlinebuf(stderr);

    bu_log("\n\nThis program is deprecated and will not be supported in future releases\n");
    bu_log("\tPlease use \"rtedge\" instead\n");
    bu_log("\tPlease notify \"[email protected]\" if you need enhancements to \"rtedge\"\n");
    bu_log("\nPress \"Enter\" to continue\n\n");
    (void)getchar();
    npsw = bu_avail_cpus();
    if (npsw > MAX_PSW)
	npsw = MAX_PSW;
    if (npsw > 1)
	RTG.rtg_parallel = 1;
    else
	RTG.rtg_parallel = 0;
    bu_semaphore_init(RT_SEM_LAST);

    init_Lgts();

    if (! pars_Argv(argc, argv)) {
	prnt_Usage();
	return 1;
    }

    for (i = 0; i < NSIG; i++)
	switch (i) {
	    case SIGINT :
		if ((norml_sig = signal(i, SIG_IGN)) == SIG_IGN) {
		    if (! tty)
			abort_sig = SIG_IGN;
		    else {
			/* MEX windows on IRIS (other than
			   the console) ignore SIGINT. */
			prnt_Scroll("WARNING: Signal 1 was being ignored!");
			goto tty_sig;
		    }
		} else {
		tty_sig:
		    norml_sig = intr_sig;
		    abort_sig = abort_RT;
		    (void) signal(i,  norml_sig);
		}
		break;
	    case SIGCHLD :
		break; /* Leave SIGCHLD alone. */
	    case SIGPIPE :
		(void) signal(i, SIG_IGN);
		break;
	    case SIGQUIT :
		break;
	    case SIGTSTP :
		(void) signal(i, stop_sig);
		break;
	}
    /* Main loop.							*/
    user_Interaction();
    /*NOTREACHED*/
    return 99; /* Stupid UTX compiler considers this as reachable. */
}