Example #1
0
void tty(void){
	oprintf("try to mount device1:partation:3:%s\n",mount("/mnt/",1,3)?"success":"failed");
	int crt_start;
	__asm__("cli");
	loadbuf=kmalloc(SIZE_LOAD_BUF);
	oprintf("tty running..welcome^.^\n");
	buff=kmalloc(23);
	for(int j=0;j<0;j++){
		oprintf("j=%u,i will do open\n",j);
//		int fd=open("/mnt/home/wws/dimg",0);
		int fd=open("/mnt/short");
		oprintf("fd:%u,inode:%u\n",fd,fd_table[fd].inode);
		int newseek=lseek(fd,-2,2);
		int r_bytes=read(fd,tmp,7);
		oprintf("r_bytes:%u,newseek:%u\n",r_bytes,newseek);
//		while(1);
	}
	while(1){
new_prompt:
		reset_cmd_asciis();
		memsetw((u16*)loadbuf,SIZE_LOAD_BUF/2,0);
		oprintf("#   ");
wait_input:
		while(1){
			unsigned ascii=getchar();
			switch(ascii){
				case 128://ctrl+l
					k_screen_reset();
					goto new_prompt;
				case 129://ctrl+c
					kill(front_pid);
					oprintf("^C\n");
					goto new_prompt;
				case 130://ctrl+u
					crt_start=get_start();
					set_start(crt_start>=80?crt_start-80:crt_start);
					goto wait_input;
				case 131://ctrl+d
					crt_start=get_start();
					set_start(crt_start<(80*24*4-1)?crt_start+80:crt_start);
					goto wait_input;
			}
			oprintf("%c",ascii);//oprintf函数有能力打印控制字符,但更多的ctrl,shift组合还要跟进
			if(ascii=='\n'){//回车符执行命令
				parse_cmd_asciis();
				break;
			}
			//执行到这儿,说明是普通输入,写入cmd_asciis
			write_cmd_asciis(ascii);
		}
	}
}
Example #2
0
 Range::Range(const CHARRANGE& range, LONG total_length)
 {
     // Check if this is an invalid range.
     if(range.cpMin==-1 && range.cpMax==-1)
     {
         *this = InvalidRange();
     }
     else
     {
         DCHECK_GE(range.cpMin, 0);
         set_start(range.cpMin);
         // {0,-1} is the "whole range" but that doesn't mean much out of context,
         // so use the |total_length| parameter.
         if(range.cpMax == -1)
         {
             DCHECK_EQ(0, range.cpMin);
             DCHECK_NE(-1, total_length);
             set_end(total_length);
         }
         else
         {
             set_end(range.cpMax);
         }
     }
 }
Example #3
0
// Control the hud timer by various mouse clicks:
// Shift+click changed mode Countdown / Stopwatch
// For Countdown, mouse wheel up/down decrease/increase start time.
//		Defaul step 5, +ctrl 1, +alt 30
// Left-click start/stop timer
// Mouse wheel click - reset timer.
//
int Hud_Timer::mouse_click(Uint32 flags)
{
	// change countdown start
	if (flags & (ELW_WHEEL_DOWN|ELW_WHEEL_UP))
	{
		int step = 5;
		if (!mode_coundown)
			return 1;
		if (flags & ELW_CTRL)
			step = 1;
		else if (flags & ELW_ALT)
			step = 30;
		if ((flags & ELW_WHEEL_UP)!=0)
			step *= -1;
		set_start(start_value + step);
	}
	// control mode
	else if (flags & ELW_SHIFT)
	{
		toggle_mode();
		do_window_close_sound();
	}
	else
	{
		// reset
		if (flags & ELW_MID_MOUSE)
			reset();
		// start / stop
		else if (flags & ELW_LEFT_MOUSE)
			toggle_running();
		do_click_sound();
	}
	return 1;
}
Example #4
0
void flasher::pin_toogled(){
	last_toggle_time=Millis.get();
	if(!flasher_active){ // first time called, note actual trip
		set_start(Speedo.trip_dist[8],Sensors.get_speed(false));
	}
	flasher_active=true;
};
PUBLIC
Jdb_kobject_list::Jdb_kobject_list()
: Jdb_list(), _current_mode(Mode::modes.begin())
{
  if (_current_mode != Mode::modes.end())
    _filter = _current_mode->filter;

  set_start(get_first());
}
void ThreadLocalAllocBuffer::initialize(HeapWord* start,
                                        HeapWord* top,
                                        HeapWord* end) {
  set_start(start);
  set_top(top);
  set_pf_top(top);
  set_end(end);
  invariants();
}
Example #7
0
int main(){
    pe_day d;
    int count = 0;
    set_start(&d);
    while (d.year < 2001){
	count += (is_counted(&d)) ? 1 : 0;
	next_day(&d);
    }
    printf("%d\n",count);
    return 0;
}
// Fills the current tlab with a dummy filler array to create
// an illusion of a contiguous Eden and optionally retires the tlab.
// Waste accounting should be done in caller as appropriate; see,
// for example, clear_before_allocation().
void ThreadLocalAllocBuffer::make_parsable(bool retire) {
  if (end() != NULL) {
    invariants();
    CollectedHeap::fill_with_object(top(), hard_end());

    if (retire || ZeroTLAB) {  // "Reset" the TLAB
      set_start(NULL);
      set_top(NULL);
      set_pf_top(NULL);
      set_end(NULL);
    }
  }
  assert(!(retire || ZeroTLAB)  ||
         (start() == NULL && end() == NULL && top() == NULL),
         "TLAB must be reset");
}
Example #9
0
int get_numGuanacos()
{
	int guanacos =0;
	// Recive num of guanacos
	printf("preguntando\n");
	START_INFOGUANACOS_MESSAGE_LOOP
		guanacos = infoGuanacos_message->amount;
	FINISH_INFOGUANACOS_MESSAGE_LOOP
	// si hay guanacos comenzar la caza
	if (guanacos > 0)
		set_start(1);
	// Sino y se ha llegado al destino, acabar la caza
	else if (get_arrive() == 1 )
		set_end(1);

	return 0;
}
PUBLIC explicit
Jdb_kobject_list::Jdb_kobject_list(Filter_func *filt)
: Jdb_list(), _current_mode(Mode::modes.end()), _filter(filt)
{ set_start(get_first()); }
long solve(void) {
  int i;
  int iter;
  double *dx, *ds, *dy, *dz;
  double minval;
  double alpha;
  work.converged = 0;
  setup_pointers();
  pre_ops();
#ifndef ZERO_LIBRARY_MODE
  if (settings.verbose)
    printf("iter     objv        gap       |Ax-b|    |Gx+s-h|    step\n");
#endif
  fillq();
  fillh();
  fillb();
  if (settings.better_start)
    better_start();
  else
    set_start();
  for (iter = 0; iter < settings.max_iters; iter++) {
    for (i = 0; i < 84; i++) {
      work.s_inv[i] = 1.0 / work.s[i];
      work.s_inv_z[i] = work.s_inv[i]*work.z[i];
    }
    work.block_33[0] = 0;
    fill_KKT();
    ldl_factor();
    /* Affine scaling directions. */
    fillrhs_aff();
    ldl_solve(work.rhs, work.lhs_aff);
    refine(work.rhs, work.lhs_aff);
    /* Centering plus corrector directions. */
    fillrhs_cc();
    ldl_solve(work.rhs, work.lhs_cc);
    refine(work.rhs, work.lhs_cc);
    /* Add the two together and store in aff. */
    for (i = 0; i < 294; i++)
      work.lhs_aff[i] += work.lhs_cc[i];
    /* Rename aff to reflect its new meaning. */
    dx = work.lhs_aff;
    ds = work.lhs_aff + 114;
    dz = work.lhs_aff + 198;
    dy = work.lhs_aff + 282;
    /* Find min(min(ds./s), min(dz./z)). */
    minval = 0;
    for (i = 0; i < 84; i++)
      if (ds[i] < minval*work.s[i])
        minval = ds[i]/work.s[i];
    for (i = 0; i < 84; i++)
      if (dz[i] < minval*work.z[i])
        minval = dz[i]/work.z[i];
    /* Find alpha. */
    if (-0.99 < minval)
      alpha = 1;
    else
      alpha = -0.99/minval;
    /* Update the primal and dual variables. */
    for (i = 0; i < 114; i++)
      work.x[i] += alpha*dx[i];
    for (i = 0; i < 84; i++)
      work.s[i] += alpha*ds[i];
    for (i = 0; i < 84; i++)
      work.z[i] += alpha*dz[i];
    for (i = 0; i < 12; i++)
      work.y[i] += alpha*dy[i];
    work.gap = eval_gap();
    work.eq_resid_squared = calc_eq_resid_squared();
    work.ineq_resid_squared = calc_ineq_resid_squared();
#ifndef ZERO_LIBRARY_MODE
    if (settings.verbose) {
      work.optval = eval_objv();
      printf("%3d   %10.3e  %9.2e  %9.2e  %9.2e  % 6.4f\n",
          iter+1, work.optval, work.gap, sqrt(work.eq_resid_squared),
          sqrt(work.ineq_resid_squared), alpha);
    }
#endif
    /* Test termination conditions. Requires optimality, and satisfied */
    /* constraints. */
    if (   (work.gap < settings.eps)
        && (work.eq_resid_squared <= settings.resid_tol*settings.resid_tol)
        && (work.ineq_resid_squared <= settings.resid_tol*settings.resid_tol)
       ) {
      work.converged = 1;
      work.optval = eval_objv();
      return iter+1;
    }
  }
  return iter;
}
Example #12
0
 segments()
 {
   set_start(0);
 }
void GraphicsDirectedEdge::
set_start(QPointF p)
{
	set_start(p.toPoint());
}
void GraphicsDirectedEdge::
set_start(int x0, int y0)
{
	set_start(QPoint(x0, y0));
}
Example #15
0
void call_svc_set_start(cli_service_t *cli_service)
{
	set_start(cli_service);
}