Пример #1
0
void attribute(int sinc[])
{
    int att_pro[CONJ]={COD_STRING};
    int attname_sig[CONJ]={COD_DOSPUNTOS};
    checkinput(att_pro,sinc);
    switch(t_actual.compLex)
    {
        case COD_STRING:
            printf("<");
            att_name(attname_sig);//llama a la funcion que va a imprimir el nombre del tag
            printf(">");
            match(COD_DOSPUNTOS);
            att_value(sinc);
            break;
        default:
            error("Se esperaba STRING");
            break;
    }
    checkinput(sinc,att_pro);
    printf("</");
    auxiliar = lex[k];//se guarda el nombre de tag que corresponda
    printf("%s",sin_comilla(auxiliar.lexema));//se imprime nombre de tag de cierre
    k--;//se posiciona en el proximo nombre de tag
    printf(">");
}
Пример #2
0
void att_list(int sinc[])
{
    int attlist_pro[CONJ]={COD_STRING};
    int att_sig[CONJ] = {COD_COMA,COD_RLLAVE};
    checkinput(attlist_pro,sinc);
    if(t_actual.compLex==COD_STRING){
        attribute(att_sig);
        pr_attlist(sinc);
    }else{
        error("Se esperaba STRING");
    }
    checkinput(sinc,attlist_pro);
}
Пример #3
0
void ele_list(int sinc[])
{
    int elelist_pro[CONJ]={COD_LLLAVE,COD_LCORCHETE};
    int ele_sig [CONJ]={EOF,COD_COMA, COD_RCORCHETE, COD_RLLAVE};
    checkinput(elelist_pro,sinc);
    if(t_actual.compLex == COD_LLLAVE || t_actual.compLex == COD_LCORCHETE){
        printf("<item>");
        element(ele_sig);
        printf("</item>");
        pr_elelist(sinc);
    }else{
        error("Se esperaba L_LLAVE, L_CORCHETE");
        checkinput(sinc,elelist_pro);
    }
}
Пример #4
0
void object(int sinc[])
{
    int obj_pro[CONJ]={COD_LLLAVE};
    checkinput(obj_pro,sinc);
    switch (t_actual.compLex)
    {
        case COD_LLLAVE:
            match(COD_LLLAVE);        
            pr_object(sinc);
            break;
        default:
            error("Se esperaba L_LLAVE");
            break;
    }   
    checkinput(sinc,obj_pro);
}
Пример #5
0
void array(int sinc[])
{
    int array_pro[CONJ]={COD_LCORCHETE};
    checkinput(array_pro,sinc);
    switch (t_actual.compLex)
    {
        case COD_LCORCHETE:
            match(COD_LCORCHETE);        
            pr_array(sinc);
            break;
        default:
            error("Se esperaba L_CORCHETE");
            break;
    }
    checkinput(sinc,array_pro);
}
Пример #6
0
char get_menu_input(){

  int x;
  char c;

  if( ( x = checkinput( 0, SEC_DELAY, USEC_DELAY ) ) < 0 )
    die();

  if( x ){
    if( read( 0, &c, 1 ) < 0 )
      die();
    
    if( c == 'o' || 
	c == 'm' || 
	c == 'd' || 
	c == 'h' || 
	c == 'p' || 
	c == 't' || 
    	c == 'b' ||
	c == 'l' || 
	c == 's' || 
	c == 'e' || 
	c == 'q' )
      lastc = c;
  }

  return lastc;
}
Пример #7
0
void element(int sinc[])
{
    int ele_pro[CONJ] = {COD_LLLAVE, COD_LCORCHETE};
    checkinput(ele_pro, sinc);
    switch(t_actual.compLex)
    {
        case COD_LLLAVE:
            object(sinc);
            break;
        case COD_LCORCHETE:
            array(sinc);
            break;
        default:
            error("Se esperaba L_LLAVE o L_CORCHETE");
            break;
    }
    checkinput(sinc,ele_pro);
}
Пример #8
0
void pr_object(int sinc[])
{
    int pr_objpro[CONJ]={COD_STRING,COD_RLLAVE};
    int attlist_sig[CONJ]={COD_RLLAVE};
    checkinput(pr_objpro,sinc);
    switch (t_actual.compLex)
    {
        case COD_STRING:
            att_list(attlist_sig);
            match(COD_RLLAVE);        
            break;
        case COD_RLLAVE:
            match(COD_RLLAVE);
            break;
        default:
            error("Se esperaba STRING o R_LLAVE");
            break;
    }
    checkinput(sinc,pr_objpro);
}
Пример #9
0
void pr_attlist(int sinc[])
{
    int prattlist_pro[CONJ]={COD_COMA};
    int att_sig[CONJ] = {COD_COMA,COD_RLLAVE};
    
    if(t_actual.compLex == COD_RLLAVE){
        checkinput(sinc,prattlist_pro);
    }else{        
        checkinput(prattlist_pro,sinc);
    }
    switch(t_actual.compLex)
    {
        case COD_COMA:
            match(COD_COMA);
            attribute(att_sig);
            pr_attlist(sinc);
            break;
    }
    checkinput(sinc,prattlist_pro);
}
Пример #10
0
void pr_elelist(int sinc[])
{
    int prlist_pro[CONJ]={COD_COMA};
    int ele_sig [CONJ]={EOF,COD_COMA, COD_RCORCHETE, COD_RLLAVE};
    if(t_actual.compLex==COD_RCORCHETE){
        checkinput(sinc,prlist_pro);
    }else{
        checkinput(prlist_pro,sinc);
    }
    switch(t_actual.compLex)
    {
        case COD_COMA:
            match(COD_COMA);
            printf("<item>");
            element(ele_sig);
            printf("</item>");
            pr_elelist(sinc);
            break;
    }
   checkinput(sinc,prlist_pro);
}
Пример #11
0
void att_value(int sinc[])
{
    int attval_pro[CONJ]={COD_LLLAVE, COD_LCORCHETE, COD_STRING, COD_NUMBER, COD_TRUE, COD_FALSE,COD_NULL};
    int ele_sig [CONJ]={EOF,COD_COMA, COD_RCORCHETE, COD_RLLAVE};
    checkinput(attval_pro,sinc);
    switch(t_actual.compLex)
    {
        case COD_LLLAVE:
            element(ele_sig);
            break;
        case COD_LCORCHETE:
            element(ele_sig);
            break;
        case COD_STRING:
            printf("%s",t_actual.lexema);//imprime nombre del tag
            match(COD_STRING);
            break;
        case COD_NUMBER:
            printf("%s",t_actual.lexema);//imprime nombre del tag
            match(COD_NUMBER);
            break;
        case COD_TRUE:
            printf("%s",t_actual.lexema);//imprime nombre del tag
            match(COD_TRUE);
            break;
        case COD_FALSE:
            printf("%s",t_actual.lexema);//imprime nombre del tag
            match(COD_FALSE);
            break;
        case COD_NULL:
            printf("%s",t_actual.lexema);//imprime nombre del tag
            match(COD_NULL);
            break;
        default:
            error("Se esperaba L_LLAVE, L_CORCHETE, STRING, NUMBER, TRUE,FALSE O NULL");
            break;
    }
    checkinput(sinc,attval_pro);
}
Пример #12
0
char get_char( )
{
     int	x;
     char	c;
     
     if ( ( x = checkinput(0, SEC_DELAY, USEC_DELAY ) ) < 0 )
	 die();
     if ( x != 0 ) {
         if ( read(0, &c, 1) < 0)
             die();
         if( c == 'a' || c == 's' || c == 'w' || c == 'd' || c == 'p' )
	     lastc = c;
     }
     return( lastc );
}
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        printf("./fsm <string>\n");
        return 0;
    }

    if(checkinput(argv[1]))
        printf("Good boy.\n");
    else
        printf("Bad boy.\n");

    return 1;
}
Пример #14
0
void pr_array(int sinc[])
{
    int pr_arpro[CONJ]={COD_LLLAVE, COD_LCORCHETE, COD_RCORCHETE};
    int elelist_sig[CONJ]={COD_RCORCHETE};
    checkinput(pr_arpro,sinc);
    switch (t_actual.compLex)
    {
        case COD_LLLAVE:
            ele_list(elelist_sig);
            match(COD_RCORCHETE);        
            break;
        case COD_LCORCHETE:
            ele_list(elelist_sig);
            match(COD_RCORCHETE);
            break;
        case COD_RCORCHETE:
            match(COD_RCORCHETE);
            break;
        default:
            error("Se esperaba L_LLAVE, L_CORCHETE o R_CORCHETE");
            break;
    }
    checkinput(sinc,pr_arpro);
}
Пример #15
0
void att_name(int sinc[])
{
    int attname_pro[CONJ]={COD_STRING};
    checkinput(attname_pro,sinc);
    switch(t_actual.compLex)
    {
        case COD_STRING:
            printf("%s",sin_comilla(t_actual.lexema));//imprime nombre del tag
            lex[++k] = t_actual;//guarda nombre del tag en caso de anidamiento
            match(COD_STRING);
            break;
        default:
            error("Se esperaba STRING");
            break;
    }
}
Пример #16
0
int machinery(void)
{
   int key,
       button = 1,
       status = 0,
       h, v;
   machineplates();
   do{
      key = checkinput();
      h = rat.horiz;
      v = rat.verti;
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
      {
         clearplates();
         status = farmpower();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
      {
         clearplates();
         status = cropping();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(2,h,v)))
      {
         clearplates();
         status = haying();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(3,h,v)))
      {
         clearplates();
         status = specialcrops();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(4,h,v)))
      {
         clearplates();
         status = dairy();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(5,h,v)))
      {
         clearplates();
         status = swine();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(6,h,v)))
      {
         clearplates();
         status = poultry();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(7,h,v)))
      {
         clearplates();
         status = genlvstock();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(8,h,v)))
      {
         clearplates();
         status = misc();
         machineplates();
      }
      if((rat.buttons == LBUTTON && key == PRESS) && (platehit(9,h,v)))
      {
         clearplates();
         status = landlords();
         machineplates();
      }
      if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
      {
	     if(buton)
		 {
		    buttonoff(1);
			buton = 0;
		 }
		 else
		 {
		    buttonon(1);
			buton = 1;
		 }
	  }
     if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
      {
	     if(buton)
		 {
		    buttonoff(1);
			buton = 0;
		 }
		 else
		 {
		    buttonon(1);
			buton = 1;
		 }
	  }
     if((rat.buttons == LBUTTON && key == PRESS) && (checkhit(2,h,v)))
     {
	    status = 1;
	 }
	 if((rat.buttons == LBUTTON && key == PRESS) && (checkhit(0,h,v)))
     {
		status = 2;
     }
     if (status == 2 || status == 1) key = ESC;
     }while(!(((rat.buttons == LBUTTON && key == RELEASE) || (key == ENTER)) && checkhit(3,h,v) || (key == ESC));
        clearplates();
        return(status);
     }
Пример #17
0
void main(void)
{
	int key,
		v,
		h;
	int oldv=0,oldh=0;
	int x1,y1,x2,y2;
	int x;

	turnon();
	graphics_setup();
	setcolor(c7);

	initrat(&rat);
	key = checkinput();
	h=rat.horiz;
	v=rat.verti;
	oldh=h;
	oldv=v;
	r1=0.0;
	r2=0.0;
	r3=0.0;
	msz=-150;
	newpos();
	while(!(key==ESC))
	{
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;
		if(oldh!=h)
		{
			if(oldh<h)
			{
				if(r1+0.1>6.28319)
					r1=0.0;
				else
					r1+=0.1;
			}
			else
			{
				if(r1-0.1<0.0)
					r1=6.28319;
				else
					r1-=0.1;
			}
			newpos();
		}
		if(oldv!=v)
		{
			if(oldv>v)
			{
				if(r3+0.1>6.28319)
					r3=0.0;
				else
					r3+=0.1;
			}
			else
			{
				if(r3-0.1<0.0)
					r3=6.28319;
				else
					r3-=0.1;
			}
			newpos();
		}
		resetrat(&rat);
		h=rat.horiz;
		v=rat.verti;
		oldh=h;
		oldv=v;
		switch(key)
		{
			case UP:	msz+=10;
						newpos();
						break;
			case DOWN:	msz-=10;
						newpos();
						break;
			case LEFT:	if(r2+0.1>6.28319)
							r2=0.0;
						else
							r2+=0.1;
						newpos();
						break;
			case RIGHT:	if(r2-0.1<0.0)
							r2=6.28319;
						else
							r2-=0.1;
						newpos();
						break;
/*			case PGUP:	hand[0]=x;
						hand[1]=y-17;
						hand[2]=x;
						hand[3]=y+8;
						hand[4]=x-10;
						hand[5]=y-12;
						hand[6]=x;
						hand[7]=y;
						hand[8]=x+10;
						hand[9]=y-12;
						hand[10]=x;
						hand[11]=y;
						drawhand(h,v,oldh,oldv);
						break;
			case PGDN:	hand[0]=x;
						hand[1]=y-17;
						hand[2]=x;
						hand[3]=y+8;
						hand[4]=x-10;
						hand[5]=y-12;
						hand[6]=x;
						hand[7]=y;
						hand[8]=x+10;
						hand[9]=y-12;
						hand[10]=x;
						hand[11]=y;
						drawhand(h,v,oldh,oldv);
						break; */
		}
	}
	ratoff();
	turnoff();
	quit_pgm();
}
Пример #18
0
int deffrm(void)
{
	int key,
		buton = 1,
		h,
		v,
		end=0;
/*		on=0; */

	dbutplt();
	showform(1,LLEFT);

	/* while exit not requested */
	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;

		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(2,h,v)))
		{
			key = ESC;
			end = 1;
		}
		if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
	} while(!(((rat.buttons == LBUTTON && key == PRESS) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	eraseform(1,LLEFT);
	clearplates();

	if(end)
		return(0);
	else
		return(1);
}
Пример #19
0
/* main menu */
void main(void)
{
	int key,
		buton = 1,
		help = 0,
		h,
		v;

	startup();						/* standard startup sequence */

	mainbuttons();
	mainplates();
	defform("70,70,16,Name,70,90,4,Left,70,110,4,Top,70,130,6,Button,"
			"70,150,8,Action");
	defform("70,70,15,Name,70,90,4,Left,70,110,4,Top,70,130,2,Length");

	/* while exit not requested */
	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;

		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
			clearplates();
			if(defbut()) key = ESC;
			mainplates();
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
			clearplates();
			if(defplt()) key = ESC;
			mainplates();
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(2,h,v)))
		{
			clearplates();
			if(deffrm()) key = ESC;
			mainplates();
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(3,h,v)))
		{
			clearplates();
			if(options()) key = ESC;
			mainplates();
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
		while((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			if(!help)
			{
				buttonoff(1);
			}
			help=1;
			key = checkinput();
			h = rat.horiz;
			v = rat.verti;
		}
		if(help)
		{
			buttonon(1);
			help=0;
		}
	} while(!(((rat.buttons == LBUTTON && key == PRESS) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	shutdown();						/* standard shutdown sequence */
}
Пример #20
0
int dfww(int argc, char *argv[], int retc, char *retv[])
/*************/
{   int firstindex;
    int lastindex;
    int step;
    int ctrace;
    int do_ww;
    int local_color;
    int imag_on;
    int redoDscale;
    int color_traces;
    int index=1;
    int maxindex=nblocks * specperblock;
    double save_sc, save_wc, save_sc2, save_wc2;

    (void) retc;
    (void) retv;
    redoDscale = dscale_onscreen();
    Wturnoff_buttons();
    plot = (argv[0][0] == 'p');
    do_ww = (argv[0][2] == 'w');
    if (Bnmr && !plot)
        return(COMPLETE);
    revflag = 0;
    if(initfid(plot+1)) return(ERROR);
    dispcalib = (float) (mnumypnts-ymin) / (float) wc2max;
    if (init_vars2()) return(ERROR);
    clearMspec();

    checkinput(argc,argv,&firstindex,&lastindex,&step,&imag_on,&color_traces);
    if (!plot)
        setwindows(argv);
    if ((firstindex < 1) || (firstindex > maxindex))
    {
        Werrprintf("spectrum %d does not exist",firstindex);
        return(ERROR);
    }

    save_sc=sc;
    save_wc=wc;
    save_sc2=sc2;
    save_wc2=wc2;

    if (lastindex < firstindex)
        lastindex = firstindex;
    if (lastindex > maxindex)
        lastindex = maxindex;
    //setscwc(firstindex,lastindex,step);
    if(plot) setscwc(firstindex,lastindex,step);
    else setscwc_new(firstindex,lastindex,step);
    setspecmaxmin();
    disp_specIndex(firstindex);

    /*  Need to change this for multiple traces...  */

    get_fid_color(argc,argv,&local_color,imag_on);
    ctrace = index = firstindex;
    if (!plot && inRepaintMode && redoDscale)
        new_dscale(FALSE,TRUE);
    if (do_ww)
        if (init_whitewash(mnumxpnts))
            do_ww = FALSE;
    while ((ctrace <= lastindex) && !interuption)
    {
        if(plot) exp_factors(FALSE);
        else calcDisplayPars();
        if(color_traces)
            local_color=((index % (NUM_AV_COLORS-2)) + FIRST_AV_COLOR + 1);

        if (calc_fid(ctrace-1))
            return(ERROR);
        if (imag_on)
            imagdisp(local_color, do_ww);
        else
            fiddisp(local_color, do_ww);
        if(plot) {
            sc += ho;
            if (!horizontal)
                sc2 += vo;
        } else {
            dss_sc += ho;
            if (!horizontal)
                dss_sc2 += vo;
        }
        ctrace += step;
        index++;
    }
    if (!plot)
    {
        ResetLabels();
        DispField(FIELD1,PARAM_COLOR,"vf",vs,1);
        InitVal(FIELD2,HORIZ,SP_NAME, PARAM_COLOR,UNIT4,
                SP_NAME, PARAM_COLOR,SCALED,2);
        InitVal(FIELD3,HORIZ,WP_NAME, PARAM_COLOR,UNIT4,
                WP_NAME, PARAM_COLOR,SCALED,2);
        if (firstindex != lastindex)
        {
            DispField(FIELD4,PARAM_COLOR,"first",(double) firstindex,0);
            DispField(FIELD5,PARAM_COLOR,"last",(double) lastindex,0);
            DispField(FIELD6,PARAM_COLOR,"step",(double) step,0);
        }
    }
    if (plot)
        amove(0,0);
    else {
        exit_display();
        Wsetgraphicsdisplay("dfs");
    }
    endgraphics();

    sc=save_sc;
    wc=save_wc;
    sc2=save_sc2;
    wc2=save_wc2;
    P_setreal(CURRENT,"sc",sc,0);
    P_setreal(CURRENT,"wc",wc,0);
    P_setreal(CURRENT,"sc2",sc2,0);
    P_setreal(CURRENT,"wc2",wc2,0);

    if (do_ww)
        close_whitewash();
    if (freebuffers()) return(ERROR);
    appendvarlist("dss_sc,dss_wc,sc,wc,vo,ho");
    return(COMPLETE);
}
Пример #21
0
void main(void)
{
	int key,
		formon = 0,
		buton = 1,
		f2 = 0,
		busy = 0,
		v,
		h,
		z;
	char test;
	int garb;

	startup();						/* standard startup sequence */

	/* Button */
	defbutton(100,450,"End");
	defbutton(400,450,"Help");
	defplate(0,25,"File");
	defplate(58,25,"Form");
    defplate(150,25,"DOS");
	defplate(350,25,"Display");
	defplate(450,25,"Clear");
	defplate(522,25,"Edit");
	defform("50,50,4,test,50,70,8,test2,50,90,6,test3"); 

	initrat(&rat);
	raton(&rat);

	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
			ratoff(&rat);
			if(formon)
			{
				if(f2) busy = 0;
				removeform();
				formon = 0;
			}
			else
			{
				if(f2) busy = 1;
				displayform();
				formon = 1;
			}
			raton(&rat);
		}
		if((rat.buttons == RBUTTON && key == PRESS) && (platehit(2,h,v)))
		{
			garb = spawnle(P_WAIT,"c:\\command.com",NULL,NULL);
			if(garb == -1)
			{
				shutdown();
				perror("\nError");
				getch();
				exit(1);
			}
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(3,h,v)))
		{
			if(f2 && !busy)
			{
				ratoff(&rat);
				showdata(0,0,testform.fld1);
				showdata(0,1,testform.fld2);
				showdata(0,2,testform.fld3);
				raton(&rat);
			}
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(4,h,v)))
		{
			if(f2 && !busy)
			{
				ratoff(&rat);
				cleanform(0,0,testform.fld1);
				cleanform(0,1,testform.fld2);
				cleanform(0,2,testform.fld3);
				raton(&rat);
			}
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(5,h,v)))
		{
			if(f2 && !busy)
			{
				ratoff(&rat);
				cleanform(0,0,testform.fld1);
				for(z=0;z<=10;z++) testform.fld1[z]=NULL;
				test=get_key();
				z=0;
				while(test != ENTER && z < 4)
				{
					testform.fld1[z]=test;
					showdata(0,0,testform.fld1);
					z++;
					test=get_key();
				}
				cleanform(0,1,testform.fld2);
				for(z=0;z<=10;z++) testform.fld2[z]=NULL;
				test=get_key();
				z=0;
				while(test != ENTER && z < 8)
				{
					testform.fld2[z]=test;
					showdata(0,1,testform.fld2);
					z++;
					test=get_key();
				}
				cleanform(0,2,testform.fld3);
				for(z=0;z<=10;z++) testform.fld3[z]=NULL;
				test=get_key();
				z=0;
				while(test != ENTER && z < 6)
				{
					testform.fld3[z]=test;
					showdata(0,2,testform.fld3);
					test=get_key();
					z++;
				}
				raton(&rat);
			}
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
			ratoff(&rat);
			if(f2)
			{
				eraseform(0,WITHOUT);
				f2 = 0;
			}
			else
			{
				showform(0,WITHOUT);
				f2 = 1;
			}
			raton(&rat);
		}
		if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			ratoff(&rat);
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
			raton(&rat);
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			ratoff(&rat);
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
			raton(&rat);
		}
	} while(!(((rat.buttons == LBUTTON && key == RELEASE) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	ratoff(&rat);

	shutdown();
}
Пример #22
0
int php3_init_request_info(void *conf)
{
	static int exit_requested = 0;
	int i, len;
	TLS_VARS;
	req = NULL;

	setalarm(idle_timeout);
	while (checkinput(server->infd) && (req = readrequest(server))) {
		alarm(0);
		if (req->reqtype == FHTTPD_REQUEST) {
			if (headermade)
				php3_fhttpd_free_header();
			response = createresponse(1024, req->id, req->fd, req->ver_major > 0);
			if (response) {
				if (req->script_name && req->script_name_resolved) {
					len = strlen(req->script_name);
					strncpy(script_name_resolved_buffer, req->script_name_resolved, 2047);
					script_name_resolved_buffer[2047] = 0;

					GLOBAL(request_info).path_info = NULL;	/* Not supported */
					GLOBAL(request_info).path_translated = script_name_resolved_buffer;
					GLOBAL(request_info).query_string = req->query_string;
					GLOBAL(request_info).current_user = NULL;
					GLOBAL(request_info).current_user_length = 0;
					GLOBAL(request_info).request_method = method_names[req->method];
					GLOBAL(request_info).script_name = req->script_name;
					GLOBAL(request_info).content_length = req->databuffsize;
					GLOBAL(request_info).content_type = req->content_type;
					GLOBAL(request_info).cookies = NULL;
					for (i = 0; i < req->nlines; i++) {
						if (req->lines[i].paramc > 1) {
							if (req->lines[i].params[0]) {
								if (!strcasecmp(req->lines[i].params[0], "HTTP_COOKIE")) {
									if (req->lines[i].params[1]) {
										GLOBAL(request_info).cookies = req->lines[i].params[1];
									}
								}
							}
						}
					}
					/* doc_root configuration variable is currently ignored,
					   as it is with every other access method currently also. */

					/* We always need to emalloc() filename, since it gets placed into
					   the include file hash table, and gets freed with that table.
					   Notice that this means that we don't need to efree() it in
					   php3_destroy_request_info()! */
					if (GLOBAL(request_info).path_translated)
						GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).path_translated);
					else
						GLOBAL(request_info).filename = NULL;

					return SUCCESS;
				} else {
					deleterequest(req);
					req = NULL;
					setalarm(idle_timeout);
				}
			} else {
				deleterequest(req);
				req = NULL;
				setalarm(idle_timeout);
			}
		} else {
			if (req->reqtype == FHTTPD_EXITOK) {
				exit_status = 1;
				deleterequest(req);
				req = NULL;
				setalarm(idle_timeout);
				return FAILURE;
			}
			deleterequest(req);
			req = NULL;
			setalarm(idle_timeout);
		}
	}
	if (global_alarmflag) {
		if (!exit_requested) {
			requestexit(server, 1);
			exit_requested = 1;
		}
	} else {
	exit_status = 1; 
	}
	return FAILURE;
}
Пример #23
0
void options(void)
{
	int key,
		buton = 1,
		h,
		v;
/*		on=0; */

	ratoff(&rat);
	optionplates();
	raton(&rat);

	/* while exit not requested */
	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;

		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
		}
		if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			ratoff(&rat);
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
			raton(&rat);
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			ratoff(&rat);
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
			raton(&rat);
		}
	} while(!(((rat.buttons == LBUTTON && key == RELEASE) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	ratoff(&rat);
	clearplates();
	raton(&rat);
}
Пример #24
0
/* main menu */
void main(void)
{
	int key,
		buton = 1,
		h,
		v,
		dbon=0,
		dpon=0;

	startup();						/* standard startup sequence */

	mainbuttons();
	mainplates();
	defform("70,70,16,Name,70,90,4,Left,70,110,4,Top,70,130,6,Button,"
			"70,150,8,Action");


	initrat(&rat);
	raton(&rat);

	/* while exit not requested */
	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;

		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
			ratoff(&rat);
			if(!dbon)
			{
				showform(0,LLEFT);
				dbon=1;
			}
			else
			{
				eraseform(0,LLEFT);
				dbon=0;
			}
			raton(&rat);
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
			ratoff(&rat);
			if(!dpon)
			{
				showform(0,LLEFT);
				dpon=1;
			}
			else
			{
				eraseform(0,LLEFT);
				dpon=0;
			}
			raton(&rat);
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(2,h,v)))
		{
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(3,h,v)))
		{
			ratoff(&rat);
			clearplates();
			raton(&rat);
			options();
			ratoff(&rat);
			mainplates();
			raton(&rat);
		}
		if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			ratoff(&rat);
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
			raton(&rat);
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			ratoff(&rat);
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
			raton(&rat);
		}
	} while(!(((rat.buttons == LBUTTON && key == RELEASE) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	ratoff(&rat);

	shutdown();						/* standard shutdown sequence */
}
Пример #25
0
int options(void)
{
	int key,
		buton = 1,
		h,
		v,
		end=0;
	int poly[10]={100,100,300,100,300,300,100,300,100,100};
/*		on=0; */

	optionplates();
	defbutton(220,450,"Previous");

	/* while exit not requested */
	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;

		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
		/* This option should toggle printing of file on and off.
			If on, file will be printed when the program that was created
			is saved.
		*/
			ratoff();
			setcolor(CCSLWHITE);
			setfillstyle(SOLID_FILL,CCSLLTBLUE);
			fillpoly(5,poly);
			raton();
			getch();
			ratoff();
			setcolor(CCSLDKBLUE);
			setfillstyle(SOLID_FILL,CCSLDKBLUE);
			fillpoly(5,poly);
			raton();
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
		/* new */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(2,h,v)))
		{
		/* load */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(3,h,v)))
		{
		/* save */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(4,h,v)))
		{
		/* write */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(5,h,v)))
		{
		/* save */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(6,h,v)))
		{
		/* change type from graphics (default) to text and vice versa */
			ratoff();
			setcolor(CCSLWHITE);
			setfillstyle(SOLID_FILL,CCSLLTBLUE);
			fillpoly(5,poly);
			raton();
			getch();
			ratoff();
			setcolor(CCSLDKBLUE);
			setfillstyle(SOLID_FILL,CCSLDKBLUE);
			fillpoly(5,poly);
			raton();
		}
		if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (checkhit(2,h,v)))
		{
			key = ESC;
			end = 1;
		}
	} while(!(((rat.buttons == LBUTTON && key == PRESS) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	clearplates();
	remove_button(2);

	if(end)
		return(0);
	else
		return(1);
}