Example #1
0
/* Scroll (change_scroll_region+parm_rindex+parm_index / csr+rin+indn) */
static void _scroll_region(TERM_REC *term, int y1, int y2, int count)
{
        /* setup the scrolling region to wanted area */
        scroll_region_setup(term, y1, y2);

	term->move(term, 0, y1);
	if (count > 0) {
		term->move(term, 0, y2);
		tput(tparm(term->TI_indn, count, count));
	} else if (count < 0) {
		term->move(term, 0, y1);
		tput(tparm(term->TI_rin, -count, -count));
	}

        /* reset the scrolling region to full screen */
        scroll_region_setup(term, 0, term->height-1);
}
Example #2
0
/* Clear screen (delete_line / dl1) */
static void _clear_del_1(TERM_REC *term)
{
	int i;

	term->move(term, 0, 0);
        for (i = 0; i < term->height; i++)
		tput(tparm(term->TI_dl1));
}
Example #3
0
/* Scroll (change_scroll_region+scroll_reverse+scroll_forward / csr+ri+ind) */
static void _scroll_region_1(TERM_REC *term, int y1, int y2, int count)
{
	int i;

        /* setup the scrolling region to wanted area */
        scroll_region_setup(term, y1, y2);

	if (count > 0) {
		term->move(term, 0, y2);
		for (i = 0; i < count; i++)
			tput(tparm(term->TI_ind));
	} else if (count < 0) {
		term->move(term, 0, y1);
		for (i = count; i < 0; i++)
			tput(tparm(term->TI_ri));
	}

        /* reset the scrolling region to full screen */
        scroll_region_setup(term, 0, term->height-1);
}
Example #4
0
/* Scroll (insert_line+delete_line / il1+dl1) */
static void _scroll_line_1(TERM_REC *term, int y1, int y2, int count)
{
	int i;

	if (count > 0) {
		term->move(term, 0, y1);
                for (i = 0; i < count; i++)
			tput(tparm(term->TI_dl1));
		term->move(term, 0, y2-count+1);
                for (i = 0; i < count; i++)
			tput(tparm(term->TI_il1));
	} else if (count < 0) {
		term->move(term, 0, y2+count+1);
		for (i = count; i < 0; i++)
			tput(tparm(term->TI_dl1));
		term->move(term, 0, y1);
		for (i = count; i < 0; i++)
			tput(tparm(term->TI_il1));
	}
}
Example #5
0
/* Move cursor from a known position */
static void _move_relative(TERM_REC *term, int oldx, int oldy, int x, int y)
{
	if (oldx == 0 && x == 0 && y == oldy+1) {
		/* move to beginning of next line -
		   hope this works everywhere */
		tput("\r\n");
                return;
	}

	if (oldx > 0 && y == oldy) {
                /* move cursor left/right */
		if (x == oldx-1 && term->TI_cub1) {
			tput(tparm(term->TI_cub1));
                        return;
		}
		if (x == oldx+1 && y == oldy && term->TI_cuf1) {
			tput(tparm(term->TI_cuf1));
                        return;
		}
	}

        /* fallback to absolute positioning */
	if (term->TI_cup) {
		tput(tparm(term->TI_cup, y, x));
                return;
	}

	if (oldy != y)
		tput(tparm(term->TI_vpa, y));
        if (oldx != x)
		tput(tparm(term->TI_hpa, x));
}
Example #6
0
/* Scroll (parm_insert_line+parm_delete_line / il+dl) */
static void _scroll_line(TERM_REC *term, int y1, int y2, int count)
{
	/* setup the scrolling region to wanted area -
	   this might not necessarily work with il/dl, but at least it
	   looks better if it does */
        scroll_region_setup(term, y1, y2);

	if (count > 0) {
		term->move(term, 0, y1);
		tput(tparm(term->TI_dl, count, count));
		term->move(term, 0, y2-count+1);
		tput(tparm(term->TI_il, count, count));
	} else if (count < 0) {
		term->move(term, 0, y2+count+1);
		tput(tparm(term->TI_dl, -count, -count));
		term->move(term, 0, y1);
		tput(tparm(term->TI_il, -count, -count));
	}

        /* reset the scrolling region to full screen */
        scroll_region_setup(term, 0, term->height-1);
}
Example #7
0
void terminfo_stop(TERM_REC *term)
{
        /* reset colors */
	terminfo_set_normal();
        /* move cursor to bottom of the screen */
	terminfo_move(0, term->height-1);

	/* stop cup-mode */
	if (term->TI_rmcup)
		tput(tparm(term->TI_rmcup));

        /* reset input settings */
	terminfo_input_deinit(term);
        fflush(term->out);
}
Example #8
0
/* Bold on */
static void _set_bold(TERM_REC *term)
{
	tput(tparm(term->TI_bold));
}
Example #9
0
/* Repeat character (rep / rp) */
static void _repeat(TERM_REC *term, int chr, int count)
{
	tput(tparm(term->TI_rep, chr, count));
}
Example #10
0
/* Reset all terminal attributes */
static void _set_normal(TERM_REC *term)
{
	tput(tparm(term->TI_normal));
}
Example #11
0
/* Move cursor (cursor_address / cup) */
static void _move_cup(TERM_REC *term, int x, int y)
{
	tput(tparm(term->TI_cup, y, x));
}
Example #12
0
/* Clear to end of line (clr_eol / el) */
static void _clrtoeol(TERM_REC *term)
{
	tput(tparm(term->TI_el));
}
Example #13
0
/* Change background color */
static void _set_bg(TERM_REC *term, int color)
{
	tput(tparm(term->TI_bg[color & 0x0f]));
}
Example #14
0
void terminfo_cont(TERM_REC *term)
{
	if (term->TI_smcup)
                tput(tparm(term->TI_smcup));
        terminfo_input_init(term);
}
Example #15
0
/* Italic on/off */
static void _set_italic(TERM_REC *term, int set)
{
	tput(tparm(set ? term->TI_sitm : term->TI_ritm));
}
Example #16
0
/* Clear screen (clear_screen / clear) */
static void _clear_screen(TERM_REC *term)
{
	tput(tparm(term->TI_clear));
}
//=============================================================================
//==  Main program                                                           ==
//=============================================================================
void sim(int argc, char *argv[])
{
  double   lambda;      // Mean arrival rate (cust/sec)
  double   mu;          // Mean service rate (cust/sec)
  double   offered_load;

  // Create the simulation
  create("sim");

  // Output usage
  if (argc != 2)
  {
    printf("Usage: 'offered_load' - offered_load between 0 and 1 \n");
    return;
  }
  offered_load = atof(argv[1]);
  assert((offered_load > 0.0) && (offered_load < 1.0));

  // CSIM initializations
  Server1 = facility("Server1");
  Server2 = facility("Server2");
  Server3 = facility("Server3");
  Server4 = facility("Server4");
  Server5 = facility("Server5");
  Resp_table = table("Response time table");

  // Parameter initializations
  mu = 1.0;
  lambda = offered_load * (double)5;

  // Output begin-of-simulation banner
  printf("*** BEGIN SIMULATION *** \n");

  // Initiate generate function and hold for SIM_TIME
  generate(lambda, mu);
  hold(SIM_TIME);

  // Output results
  printf("============================================================= \n");
  printf("==   *** CSIM 5 x M/M/1 queueing system simulation ***     == \n");
  printf("============================================================= \n");
  printf("= Lambda               = %6.3f cust/sec   \n", lambda);
  printf("= Mu (for each server) = %6.3f cust/sec   \n", mu);
  printf("============================================================= \n");
  printf("= Total CPU time     = %6.3f sec      \n", cputime());
  printf("= Total sim time     = %6.3f sec      \n", clock);
  printf("= Total completions  = %ld cust       \n",
    (completions(Server1) + completions(Server2) + completions(Server3) + completions(Server4) + completions(Server5)));
  printf("=------------------------------------------------------------ \n");
  printf("= >>> Simulation results                                    - \n");
  printf("=------------------------------------------------------------ \n");
  printf("= Utilization 1        = %6.3f %%       \n", 100.0 * util(Server1));
  printf("= Mean num in system 1 = %6.3f cust     \n", qlen(Server1));
  printf("= Mean response time 1 = %6.3f sec      \n", resp(Server1));
  printf("= Mean service time 1  = %6.3f sec      \n", serv(Server1));
  printf("= Mean throughput 1    = %6.3f cust/sec \n", tput(Server1));
  printf("=------------------------------------------------------------ \n");
  printf("= Utilization 2        = %6.3f %%       \n", 100.0 * util(Server2));
  printf("= Mean num in system 2 = %6.3f cust     \n", qlen(Server2));
  printf("= Mean response time 2 = %6.3f sec      \n", resp(Server2));
  printf("= Mean service time 2  = %6.3f sec      \n", serv(Server2));
  printf("= Mean throughput 2    = %6.3f cust/sec \n", tput(Server2));
  printf("=------------------------------------------------------------ \n");
  printf("= Utilization 3        = %6.3f %%       \n", 100.0 * util(Server3));
  printf("= Mean num in system 3 = %6.3f cust     \n", qlen(Server3));
  printf("= Mean response time 3 = %6.3f sec      \n", resp(Server3));
  printf("= Mean service time 3  = %6.3f sec      \n", serv(Server3));
  printf("= Mean throughput 3    = %6.3f cust/sec \n", tput(Server3));
  printf("=------------------------------------------------------------ \n");
  printf("= Utilization 4        = %6.3f %%       \n", 100.0 * util(Server4));
  printf("= Mean num in system 4 = %6.3f cust     \n", qlen(Server4));
  printf("= Mean response time 4 = %6.3f sec      \n", resp(Server4));
  printf("= Mean service time 4  = %6.3f sec      \n", serv(Server4));
  printf("= Mean throughput 4    = %6.3f cust/sec \n", tput(Server4));
  printf("=------------------------------------------------------------ \n");
  printf("= Utilization 5        = %6.3f %%       \n", 100.0 * util(Server5));
  printf("= Mean num in system 5 = %6.3f cust     \n", qlen(Server5));
  printf("= Mean response time 5 = %6.3f sec      \n", resp(Server5));
  printf("= Mean service time 5  = %6.3f sec      \n", serv(Server5));
  printf("= Mean throughput 5    = %6.3f cust/sec \n", tput(Server5));
  printf("=------------------------------------------------------------ \n");
  printf("& Table mean for response time = %6.3f sec   \n",
    table_mean(Resp_table));
  printf("============================================================= \n");

  // Output end-of-simulation banner
  printf("*** END SIMULATION *** \n");
  getchar();
}
Example #18
0
/* Change foreground color */
static void _set_fg(TERM_REC *term, int color)
{
	tput(tparm(term->TI_fg[color256(term, color)]));
}
Example #19
0
/* Set cursor visible/invisible */
static void _set_cursor_visible(TERM_REC *term, int set)
{
	tput(tparm(set ? term->TI_cnorm : term->TI_civis));
}
Example #20
0
int
main(int argc, char **argv)
{
    char *term;
    int errret;
    bool cmdline = TRUE;
    int c;
    char buf[BUFSIZ];
    int result = 0;

    check_aliases(prg_name = _nc_rootname(argv[0]));

    term = getenv("TERM");

    while ((c = getopt(argc, argv, "ST:V")) != -1) {
	switch (c) {
	case 'S':
	    cmdline = FALSE;
	    break;
	case 'T':
	    use_env(FALSE);
	    term = optarg;
	    break;
	case 'V':
	    puts(curses_version());
	    ExitProgram(EXIT_SUCCESS);
	default:
	    usage();
	    /* NOTREACHED */
	}
    }

    /*
     * Modify the argument list to omit the options we processed.
     */
    if (is_reset || is_init) {
	if (optind-- < argc) {
	    argc -= optind;
	    argv += optind;
	}
	argv[0] = prg_name;
    } else {
	argc -= optind;
	argv += optind;
    }

    if (term == 0 || *term == '\0')
	quit(2, "No value for $TERM and no -T specified");

    if (setupterm(term, STDOUT_FILENO, &errret) != OK && errret <= 0)
	quit(3, "unknown terminal \"%s\"", term);

    if (cmdline) {
	if ((argc <= 0) && !is_reset && !is_init)
	    usage();
	ExitProgram(tput(argc, argv));
    }

    while (fgets(buf, sizeof(buf), stdin) != 0) {
	char *argvec[16];	/* command, 9 parms, null, & slop */
	int argnum = 0;
	char *cp;

	/* crack the argument list into a dope vector */
	for (cp = buf; *cp; cp++) {
	    if (isspace(UChar(*cp))) {
		*cp = '\0';
	    } else if (cp == buf || cp[-1] == 0) {
		argvec[argnum++] = cp;
		if (argnum >= (int) SIZEOF(argvec) - 1)
		    break;
	    }
	}
	argvec[argnum] = 0;

	if (argnum != 0
	    && tput(argnum, argvec) != 0) {
	    if (result == 0)
		result = 4;	/* will return value >4 */
	    ++result;
	}
    }

    ExitProgram(result);
}
Example #21
0
/* Move cursor (column_address+row_address / hpa+vpa) */
static void _move_pa(TERM_REC *term, int x, int y)
{
	tput(tparm(term->TI_hpa, x));
	tput(tparm(term->TI_vpa, y));
}
Example #22
0
/* Underline on/off */
static void _set_uline(TERM_REC *term, int set)
{
	tput(tparm(set ? term->TI_smul : term->TI_rmul));
}
Example #23
0
/* Clear screen (clr_eos / ed) */
static void _clear_eos(TERM_REC *term)
{
        term->move(term, 0, 0);
	tput(tparm(term->TI_ed));
}
Example #24
0
/* Standout on/off */
static void _set_standout(TERM_REC *term, int set)
{
	tput(tparm(set ? term->TI_smso : term->TI_rmso));
}
Example #25
0
/* Clear screen (parm_delete_line / dl) */
static void _clear_del(TERM_REC *term)
{
        term->move(term, 0, 0);
	tput(tparm(term->TI_dl, term->height, term->height));
}
Example #26
0
/* Beep */
static void _beep(TERM_REC *term)
{
	tput(tparm(term->TI_bel));
}
Example #27
0
static void _set_blink(TERM_REC *term)
{
	tput(tparm(term->TI_blink));
}
Example #28
0
/* Reverse on */
static void _set_reverse(TERM_REC *term)
{
	tput(tparm(term->TI_rev));
}
void pnt_id_cust()
{
    tput( 4, 10, "Customer Name" );
    tput( 6, 10, "Company Name" );
    tput( 7, 10, "Phone Number" );

    tput( 9, 10, "Ship to Name" );
    tput( 10, 18, "Company" );
    tput( 11, 18, "Street" );
    tput( 12, 18, "2nd Street" );
    tput( 13, 18, "City" );
    tput( 13, 49, "State" );
    tput( 13, 60, "Zip" );

    tput( 15, 10, "Bill to Name" );
    tput( 16, 18, "Company" );
    tput( 17, 18, "Street" );
    tput( 18, 18, "2nd Street" );
    tput( 19, 18, "City" );
    tput( 19, 49, "State" );
    tput( 19, 60, "Zip" );

    tput( 21, 10, "Resale?" );
    tput( 21, 30, "Resale Permit Number" );
    tput( 23, 10, "Advertising Ref" );
}