Example #1
0
cfg_t::cfg_t(backend_visitor *v)
{
   create(v->mem_ctx, &v->instructions);
}
Example #2
0
PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(HeapType heapType)
{
    return create(heapType);
}
Example #3
0
void GMainLoopSource::scheduleAndDeleteOnDestroy(const char* name, std::function<bool()> function, int priority, std::function<void()> destroyFunction, GMainContext* context)
{
    create().schedule(name, function, priority, destroyFunction, context);
}
Example #4
0
void test_creation_of_character_circular_queue(){
	CircularQueue* actual = create(sizeof(char),3);
	char exp_arr[] = {0,0,0};
	CircularQueue expected = {exp_arr,-1,-1,3,sizeof(char)};
	ASSERT(compareQueue(actual,&expected));
};
Example #5
0
void test_creation_of_double_circular_queue(){
	CircularQueue* actual = create(sizeof(double),3);
	double exp_arr[] = {0.0,0.0,0.0};
	CircularQueue expected = {exp_arr,-1,-1,3,sizeof(double)};
	ASSERT(compareQueue(actual,&expected));
};
int runEppTestSecDns(EppParser& parser)
{


	DOMNode* n;

	EppDomain domain("DOMAIN.BIZ");
	EppAuthInfo authInfo(EppAuthInfo::TYPE_PW, "3fooBar");
	domain.setAuthInfo(authInfo);
	EppCommandCreate create(&domain, "ABC-DEF-XXXX-ID");

	EppCommandCreateSecDns * createSecDns = new EppCommandCreateSecDns();
	EppSecDnsDsData ds0;
	EppSecDnsDsData ds1;
	time_t cal = ::time(0);

	char * str0 = "ABCDEF012345789";
	char * str1 = "012345789ABCDEF";

	ds0.setKeyTag(12345);
	ds0.setAlgorithm(3);
	ds0.setDigestType(1);
	//ds0.setDigest((unsigned char *) str0, 16);
	//ds0.setStartDate(cal);
	//ds0.setEndDate(cal + 86400 * 365);

	ds1.setKeyTag(54321);
	ds1.setAlgorithm(3);
	ds1.setDigestType(1);
	//ds1.setDigest((unsigned char *) str1, 16);
	//ds1.setStartDate(cal + 86400 * 365);
	//ds1.setEndDate(cal + 86400 * 730);
	//ds1.setValidationInterval("P60D");

	createSecDns->add(ds0);
	createSecDns->add(ds1);

	create.addExtension(createSecDns);

	cout << create.toString() << endl;
	parser.parse(create.toString());
	n = parser.getRootNode();
	EppCommandCreate * newCreate = (EppCommandCreate *) EppCommand::fromXML(*n);
	cout << newCreate->toString() << endl;
	delete newCreate;

	EppCommandUpdateDomain updateDomainAdd("DOMAIN.BIZ");
	updateDomainAdd.setClientTransactionId("CLINET-XID");

	EppCommandUpdateSecDns * addSecDns = new EppCommandUpdateSecDns();
	addSecDns->add(ds0);
	addSecDns->add(ds1);
	updateDomainAdd.addExtension(addSecDns);

	cout << updateDomainAdd.toString() << endl;
	parser.parse(updateDomainAdd.toString());
	n = parser.getRootNode();
	EppCommandUpdate * newUpdateDomainAdd = (EppCommandUpdate *) EppCommand::fromXML(*n);
	cout << newUpdateDomainAdd->toString() << endl;
	delete newUpdateDomainAdd;

	EppCommandUpdateDomain updateDomainChg("DOMAIN.BIZ");
	updateDomainChg.setClientTransactionId("CLINET-XID");

	EppCommandUpdateSecDns * chgSecDns = new EppCommandUpdateSecDns();
	chgSecDns->change(ds0);
	chgSecDns->change(ds1);
	updateDomainChg.addExtension(chgSecDns);

	cout << updateDomainChg.toString() << endl;
	parser.parse(updateDomainChg.toString());
	n = parser.getRootNode();
	EppCommandUpdate * newUpdateDomainChg = (EppCommandUpdate *) EppCommand::fromXML(*n);
	cout << newUpdateDomainChg->toString() << endl;
	delete newUpdateDomainChg;

	EppCommandUpdateDomain updateDomainRem("DOMAIN.BIZ");
	updateDomainRem.setClientTransactionId("CLINET-XID");

	EppCommandUpdateSecDns * remSecDns = new EppCommandUpdateSecDns();
	updateDomainRem.addExtension(remSecDns);

	cout << updateDomainRem.toString() << endl;
	parser.parse(updateDomainRem.toString());
	n = parser.getRootNode();
	EppCommandUpdate * newUpdateDomainRem = (EppCommandUpdate *) EppCommand::fromXML(*n);
	cout << newUpdateDomainRem->toString() << endl;
	delete newUpdateDomainRem;

	EppResult result(EppError::CODE_NO_ERROR);
	EppValueReason reason0("Value0", "Reason0", "en_US");
	EppValueReason reason4("Value4");
	result.addValue(reason0);
	result.addValue("Value1");
	result.addValue("Value2");
	result.addValue("Value3");
	result.addValue(reason4);
	EppTransactionId trid("CLIENT-XID", "SERVER-ID");
	EppResponse rsp;
	rsp.addResult(result);
	rsp.setTransactionId(trid);
	EppResponseDataInfo infData(&domain);
	rsp.setResponseData(&infData);

	EppResponseDataInfoSecDns * infSecDns = new EppResponseDataInfoSecDns();
	infSecDns->add(ds0);
	infSecDns->add(ds1);
	rsp.addExtension(infSecDns);

	cout << rsp.toString() << endl;
	parser.parse(rsp.toString());
	n = parser.getRootNode();
	EppResponse * newRsp = EppResponse::fromXML(*n);
	cout << newRsp->toString() << endl;
	delete newRsp;

	return 0;
}
Example #7
0
StackTraceNoHeap::StackTraceNoHeap(bool trace) {
  if (trace && Enabled) {
    create();
  }
}
Example #8
0
void ViewZoneDlg::doDialog()
{
    if (!isCreated())
        create(IDD_VIEWZONE);
    display();
};
int GatherPolicy::reload()
{
  destroy();
  return create();
}
Example #10
0
NDBT_Thread::NDBT_Thread()
{
  create(0, -1);
}
Example #11
0
NDBT_Thread::NDBT_Thread(NDBT_ThreadSet* thread_set, int thread_no)
{
  create(thread_set, thread_no);
}
Example #12
0
 void setUp() {
   create();
 }
Example #13
0
void test_create_should_create_a_head_with_null(){
	listPtr = create();
	ASSERT(listPtr->length == 0);
	ASSERT(listPtr->head == NULL );
}
Example #14
0
cfg_t::cfg_t(void *mem_ctx, exec_list *instructions)
{
   create(mem_ctx, instructions);
}
Example #15
0
void test_top_return_top_null_of_stack_if_stack_empty(){
	Stack* stack = create(sizeof(int),3);
	ASSERT(!top(stack));
}
    int Cornea::computeCentre(const std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > &led_pos, // LED locations
                              const std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > &glint_pos,
                              std::vector<double> &gx_guesses,
                              Eigen::Vector3d &centre,
                              double &err) {

        // initialise the cornea tracker
        create(led_pos, glint_pos);

        /*
         * Check out usage and more info about GSL:
         * http://www.csse.uwa.edu.au/programming/gsl-1.0/gsl-ref_35.html
         */

        const size_t n = 3 * pairsOfTwo(data.size());	// number of functions
        const size_t p = gx_guesses.size();				// number of parameters

        // initial guesses
        gsl_vector_const_view x = gsl_vector_const_view_array(gx_guesses.data(), p);

        gsl_multifit_function_fdf f;
        f.f			= &my_f;	// function
        f.df		= &my_df;	// derivative
        f.fdf		= &my_fdf;	// both
        f.n			= n;		// number of functions
        f.p			= p;		// number of parameters
        f.params	= this;		// additional parameter

        const gsl_multifit_fdfsolver_type *T = gsl_multifit_fdfsolver_lmsder;
        gsl_multifit_fdfsolver *solver = gsl_multifit_fdfsolver_alloc(T, n, p);
        gsl_multifit_fdfsolver_set(solver, &f, &x.vector);


        int status;
        unsigned int iter = 0;

        do {
            iter++;
            status = gsl_multifit_fdfsolver_iterate(solver);

            if(status) {
                break;
            }

            status = gsl_multifit_test_delta(solver->dx, solver->x, PRECISION, PRECISION);

        }
        while(status == GSL_CONTINUE && iter < MAX_ITER);

        if(iter == MAX_ITER) {
            printf("Cornea::computeCentre(): iter = MAX_ITER\n");
        }


        gsl_matrix *covar = gsl_matrix_alloc(p, p);
        gsl_multifit_covar(solver->J, 0.0, covar);

        // for(int row = 0; row < p; ++row) {
        //     for(int col = 0; col < p; ++col) {
        //         printf("%.2f ", covar->data[row * p + col]);
        //     }
        //     printf("\n");
        // }
        // printf("*****************************\n");

        /***********************************************************************
         * Compute the fit error
         **********************************************************************/

        err = 0;
        for(size_t i = 0; i < p; i++) {
            err += gsl_matrix_get(covar, i, i);
        }
        err = std::sqrt(err);


        Eigen::Vector3d cw(0.0, 0.0, 0.0);

        // cornea sphere radius
        const double RHO = trackerSettings.RHO;

        // remove this
        double dMaxX = -10.0;

        for(size_t i = 0; i < data.size(); ++i) {

            const DATA_FOR_CORNEA_COMPUTATION &cur_data = data[i];

            const double gx_guess = gsl_vector_get(solver->x, i);

            const double B_aux = atan2(gx_guess * tan(cur_data.alpha_aux), (cur_data.l_aux - gx_guess));

            // calculate the corneal sphere centers in the auxiliary coordinate systems
            const Eigen::Vector3d c_aux(gx_guess - RHO * sin((cur_data.alpha_aux - B_aux) / 2.),
                                        0.,
                                        gx_guess * tan(cur_data.alpha_aux) + RHO * cos((cur_data.alpha_aux - B_aux) / 2.));

            const Eigen::Vector3d tmp = cur_data.R * c_aux;

            cw(0) += tmp(0);
            cw(1) += tmp(1);
            cw(2) += tmp(2);

            if(tmp(0) > dMaxX) {
                dMaxX = tmp(0);
            }

            //        printf("%i: centre (mm): %.2f %.2f %.2f\n", (int)i, 1000.0*tmp(0), 1000.0*tmp(1), 1000.0*tmp(2));

        }

        const double nof_samples = (double)data.size();
        centre << cw(0) / nof_samples, cw(1) / nof_samples, cw(2) / nof_samples;


        // printf("Avg: %.2f %.2f %.2f\n", 1000.0*centre(0), 1000.0*centre(1), 1000.0*centre(2));
        // printf("*********************************\n");

        gsl_multifit_fdfsolver_free(solver);
        gsl_matrix_free(covar);

        return (int)iter;

    }
Example #17
0
File: Posix.c Project: 8l/NxM
int
mycreat(char *n, int p)
{

	return create(n, 1, p);
}
Example #18
0
MenuWorldLeadOut::MenuWorldLeadOut(const string &imageFileName)
{
	create(imageFileName);
}
Example #19
0
StackTrace::StackTrace(bool trace) {
  if (trace && Enabled) {
    create();
  }
}
Example #20
0
shellcmd xsh_prodcons(int nargs, char *args[])
{
	
	int count = 0;
	//Argument verifications and validations

	if (nargs == 2 && strncmp(args[1], "--help", 7) == 0) {
		printf("Usage: %s\n\n", args[0]);
		printf("Description:\n");
		printf("\tDisplays Producer Consumer Problem\n");
		printf("\tAccepts 1 optional integer argument\n");
		printf("\tDefault Integer argument = 2000\n");
		return 0;
	} else if (nargs == 2 && strncmp(args[1], "-f", 3) == 0) {
		
		future *f_queue;
		future *f_exclusive;
		future *f_shared;
		f_exclusive = future_alloc(FUTURE_EXCLUSIVE);
		f_shared = future_alloc(FUTURE_SHARED);
		f_queue = future_alloc(FUTURE_QUEUE);
 
		//Test FUTURE_EXCLUSIVE
		resume( create(future_cons, 1024, 20, "fcons1", 1, f_exclusive) );
		resume( create(future_prod, 1024, 20, "fprod1", 1, f_exclusive) );

		// Test FUTURE_SHARED
		resume( create(future_cons, 1024, 20, "fcons2", 1, f_shared) );
		resume( create(future_cons, 1024, 20, "fcons3", 1, f_shared) );
		resume( create(future_cons, 1024, 20, "fcons4", 1, f_shared) ); 
		resume( create(future_cons, 1024, 20, "fcons5", 1, f_shared) );
		resume( create(future_prod, 1024, 20, "fprod2", 1, f_shared) );

		// Test FUTURE_QUEUE

		resume( create(future_cons, 1024, 20, "fcons6", 1, f_queue) );
		resume( create(future_cons, 1024, 20, "fcons7", 1, f_queue) );
		resume( create(future_cons, 1024, 20, "fcons7", 1, f_queue) );
		resume( create(future_cons, 1024, 20, "fcons7", 1, f_queue) );
		resume( create(future_prod, 1024, 20, "fprod3", 1, f_queue) );
		resume( create(future_prod, 1024, 20, "fprod4", 1, f_queue) );
		resume( create(future_prod, 1024, 20, "fprod5", 1, f_queue) );
		resume( create(future_prod, 1024, 20, "fprod6", 1, f_queue) );

	} else if (nargs > 2) {
		fprintf(stderr, "%s: too many arguments\n", args[0]);
		fprintf(stderr, "Try '%s --help' for more information\n",
			args[0]);
		return 1;
	} else if (nargs == 1) {
		count = 2000;
	} else {
 		char *s = args[1];
		int i;
		for(i = 0; i<strlen(s); i++) {
			if(s[i] >= '0' && s[i] <='9') {
				count *= 10;
				count += s[i] - '0'; 
			} else {
				fprintf(stderr, "%s: invalid arguments\n", args[0]);
				fprintf(stderr, "Try '%s --help' for more information\n",
				args[0]);
				return 1;
			} 

		}
	}
	consumed = semcreate(0);      
      	produced = semcreate(1);

      	//create the process producer and consumer and put them in ready queue.
      	//Look at the definations of function create and resume in exinu/system folder for reference.      
      	resume( create(producer, 1024, 20, "producer", 1, count) );
      	resume( create(consumer, 1024, 20, "consumer", 1, count) );
}
Example #21
0
void test_user_should_be_informed_when_queue_is_empty(){
	CircularQueue *actual = create(sizeof(int),3);
	int res = isEmpty(actual);
	ASSERT(1 == res);	
};
Example #22
0
void test_push_int_element_at_top_of_stack(){
	int element = 5;
	Stack* stack = create(sizeof(int),5);
	push(stack , &element);
	ASSERT(5 == *(int*)pop(stack));
}
Example #23
0
void test_creation_of_float_circular_queue(){
	CircularQueue* actual = create(sizeof(float),3);
	float exp_arr[] = {0.0f,0.0f,0.0f};
	CircularQueue expected = {exp_arr,-1,-1,3,sizeof(float)};
	ASSERT(compareQueue(actual,&expected));
};
Example #24
0
void test_push_float_element_at_top_of_stack(){
	float element = 5.5f;
	Stack* stack = create(sizeof(float),5);
	push(stack , &element);
	ASSERT(5.5f == *(float*)pop(stack));
}
Example #25
0
void test_creation_of_String_circular_queue(){
	CircularQueue* actual = create(sizeof(String),3);
	String exp_arr[] = {"","",""};
	CircularQueue expected = {exp_arr,-1,-1,3,sizeof(String)};
	ASSERT(compareQueue(actual,&expected));
};
Example #26
0
void test_push_string_element_at_top_of_stack(){
	string element = "AAA";
	Stack* stack = create(sizeof(string),5);
	push(stack , &element);
	ASSERT(!strcmp("AAA" , *(string*)pop(stack)));
}
BackbufferSurfaceD3D11::BackbufferSurfaceD3D11(Ctr::IDevice* device, IDXGISwapChain* swapChain) :
    SurfaceD3D11(device),
    _swapChain (swapChain)
{
    create();
}
Example #28
0
void test_pop_return_false_if_stack_is_empty(){
	Stack* stack = create(sizeof(int),3);
	ASSERT(!pop(stack));
}
Example #29
0
void GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function<bool()> function, std::chrono::seconds delay, int priority, std::function<void()> destroyFunction, GMainContext* context)
{
    create().scheduleAfterDelay(name, function, delay, priority, destroyFunction, context);
}
PassRefPtr<Text> Text::cloneWithData(const String& data)
{
    return create(document(), data);
}