Beispiel #1
0
static do_qnumber()
{
Menuhdr *mh;
SHORT val = 50;
Errcode err;

	err = new_qreq_number(&val,0,111,"the top line of text");
  	boxf("ecode %d, val = %d", err, val ); 
}
Beispiel #2
0
void main(int argc, char **argv)
{
Errcode err;
int i;


	if(argc > 1)
		rex_name = argv[1];
	if(init_sys() < 0)
		exit(-1);

	pj_set_rast(vl.screen,4);

test_uscale();

/*	do_testpull(); */

	if(!yes_no_line("continue ??"))
		goto exitit;

	do_qnumber();

	if(!yes_no_line("continue ??"))
		goto exitit;
{
char *choices[] = {
	"choice 1",
	"choice 2",
	"a very very big choice",
};

	err = qchoice(NULL, "header", choices, sizeof(choices)/sizeof(char *));
	boxf("choice %d", err);
}

	goto exitit;

error:
	boxf("error %d", err);
exitit:
	uninit_sys();
	exit(-1);
}
Beispiel #3
0
void simulation::simuMonteCarlo(int NB)
{
    dataf.clear();//Nettoie la liste de positions

    Function fonct_f("f.txt");
    Function fonct_g("g.txt");

    //Genere les positions x1,x2 aleatoirement (methode de Monte Carlo)
    double t = 0;
    double x1, x2, x3;
    int flag = 0;

    //On verifie qu'on est bien dans la bulle de départ G0
    while(flag!=1)
    {
        x1 = (rand()% 2000 - 1000)/1000.0;
        x2 = (rand()% 2000 - 1000)/1000.0;
        x3 = (rand()% 1000 - 500)/100.0;

        IntervalVector box(4);
        box[0] = Interval(x1);
        box[1] = Interval(x2);
        box[2] = Interval(x3);
        box[3] = Interval(t);
        //cout<<fonct_g.eval_vector(box)[0].mid();
        //cout<<fonct_g.eval_vector(box)[0];
        if(fonct_g.eval_vector(box)[0].mid() <= 0 && fonct_g.eval_vector(box)[1].mid()<=0 )
            flag = 1;
    }



    //Box pour f
    IntervalVector boxf(4);
    boxf[0] = Interval(x1);
    boxf[1] = Interval(x2);
    boxf[2] = Interval(x3);
    boxf[3] = Interval(t);


    for (double i=0 ; i<NB ;i++){
        dataf.push_back(boxf);
        boxf = boxf + dt*fonct_f.eval_vector(boxf);
        t += dt;
        boxf[3] = Interval(t);
        boxf[0] = boxf[0].mid();
        boxf[1] = boxf[1].mid();
        boxf[2] = boxf[2].mid();

     }
}
Beispiel #4
0
static Errcode grc_unss2_rect(Raster *v, void *ucbuf, LONG pixsize,
	Coor xorg, Coor yorg, Ucoor width, Ucoor height)
/* Uncompress data into a rectangular area inside raster using
   word-run-length/delta compression scheme used in Autodesk Animator 386
   for most frames except the first. */
/* (Unclipped.) */
{
Coor x,y;
SHORT lp_count;
SHORT opcount;
int psize;
union {SHORT *w; UBYTE *ub; BYTE *b;} wpt;
Coor lastx;
Pixel sbuf[SBUF_SIZE/sizeof(Pixel)];
Pixel *linebuf;
(void)pixsize;
(void)height;

	if(width > Array_els(sbuf))
	{
		if ((linebuf = pj_malloc(width*sizeof(Pixel))) == NULL)
			return(Err_no_memory);
	}
	else
		linebuf = sbuf;

	lastx = xorg + width - 1;
	wpt.w = ucbuf;
	lp_count = *wpt.w++;
	y = yorg;
	goto LPACK;

SKIPLINES:

	y -= opcount;

LPACK:	/* do next line */
	if ((opcount = *wpt.w++) >= 0)
		goto DO_SS2OPS;

	if( ((USHORT)opcount) & 0x4000) /* skip lines */
		goto SKIPLINES;

	PUT_DOT(v,(UBYTE)opcount,lastx,y); /* put dot at eol with low byte */
	if((opcount = *wpt.w++) == 0)
	{
		++y;
		if (--lp_count > 0)
			goto LPACK;
		goto OUT;
	}
DO_SS2OPS:
	x = xorg;

PPACK:				/* do next packet */
	x += *wpt.ub++;
	psize = *wpt.b++;
	if ((psize += psize) >= 0)
	{

#ifdef DEBUG
		if(!psize)
			boxf("zero putsize opcnt %d", opcount);
#endif

		PUT_HSEG(v, wpt.ub, x, y, psize);
		x += psize;
		wpt.ub += psize;
		if (--opcount != 0)
			goto PPACK;
		++y;
		if (--lp_count > 0)
			goto LPACK;
	}
	else
	{
		psize = -psize;
		if (wpt.b[0] == wpt.b[1])
		{
#ifdef DEBUG
			if((x + psize) >= v->width
				|| x < 0
				|| y < 0
				|| y >= v->height
				|| psize <= 0)
			{
				boxf("oops out of screen bounds x %d y %d sz %d oc %d",
					  x, y, psize, opcount );
			}
#endif
			SET_HLINE(v, *wpt.b, x, y, psize);
			++wpt.w;
			x += psize;
			if (--opcount != 0)
				goto PPACK;
			++y;
			if (--lp_count > 0)
				goto LPACK;
		}
		else
		{
#ifdef DEBUG
			if((psize>>1) == 0)
				boxf("zero stuff count");
#endif

			pj_stuff_words(*wpt.w++, (SHORT *)linebuf, psize>>1);
			PUT_HSEG(v, linebuf, x, y, psize);
			x += psize;
			if (--opcount != 0)
				goto PPACK;
			++y;
			if (--lp_count > 0)
				goto LPACK;
		}
	}
OUT:
	if(linebuf != sbuf)
		pj_free(linebuf);
	return(Success);
}
Beispiel #5
0
static void test_selit(SHORT *ixs)
{
	boxf("test selit %d %d", ixs[0], ixs[1]);
}