Exemplo n.º 1
0
void print(const CMPIData& data)
{
    if (data.state & CMPI_nullValue)
    {
        printf("null");
        return;
    }

    if (CMIsArray(data))
    {
        printf("{");

        CMPICount n = CMGetArrayCount(data.value.array, NULL);

        for (CMPICount i = 0; i < n; i++)
        {
            CMPIData td = CMGetArrayElementAt(data.value.array, i, NULL);
            print_scalar(td);

            if (i + 1 != n)
                printf(",");
        }

        printf("}");
    }
    else
        print_scalar(data);
}
Exemplo n.º 2
0
int scalar_callback(const PDS_scalar *scalar, void *user_data)
{
    state_t *state = (state_t*)user_data;
    const expected_t *expected = state->expected;
    print_scalar(scalar);
    if(!compare_scalar(scalar, expected->scalar))
    {
        fprintf(stderr, "scalar value mismatch\n");
        return 0;
    }
    return 1;
}
Exemplo n.º 3
0
Arquivo: planner.c Projeto: ADTL/TinyG
void mp_dump_runtime_state(void)
{
	fprintf_P(stderr, PSTR("***Runtime Singleton (mr)\n"));
	print_scalar(PSTR("line number:       "), mr.linenum);
	print_vector(PSTR("position:          "), mr.position, AXES);
	print_vector(PSTR("target:            "), mr.target, AXES);
	print_scalar(PSTR("length:            "), mr.length);

	print_scalar(PSTR("move_time:         "), mr.move_time);
//	print_scalar(PSTR("accel_time;        "), mr.accel_time);
//	print_scalar(PSTR("elapsed_accel_time:"), mr.elapsed_accel_time);
	print_scalar(PSTR("midpoint_velocity: "), mr.midpoint_velocity);
//	print_scalar(PSTR("midpoint_accel:    "), mr.midpoint_acceleration);
//	print_scalar(PSTR("jerk_div2:         "), mr.jerk_div2);

	print_scalar(PSTR("segments:          "), mr.segments);
	print_scalar(PSTR("segment_count:     "), mr.segment_count);
	print_scalar(PSTR("segment_move_time: "), mr.segment_move_time);
//	print_scalar(PSTR("segment_accel_time:"), mr.segment_accel_time);
	print_scalar(PSTR("microseconds:      "), mr.microseconds);
	print_scalar(PSTR("segment_length:	  "), mr.segment_length);
	print_scalar(PSTR("segment_velocity:  "), mr.segment_velocity);
}
Exemplo n.º 4
0
int set_element_callback(const PDS_scalar *scalar, void *user_data)
{
    state_t *state = (state_t*)user_data;
    const expected_t *expected = state->expected;
    if(state->index >= expected->count)
    {
        fprintf(stderr, "too many scalars\n");
        return 0;
    }
    if(!compare_scalar(scalar, &(expected->scalar[state->index]))) 
    {
        fprintf(stderr, "scalar value mismatch\n");
        return 0;
    }
    state->index++;
    
    printf("\t");
    print_scalar(scalar);

    return 1;
}
Exemplo n.º 5
0
int read_scalar ()
{
    ADIOS_FILE * f;
    float timeout_sec = 0.0; 
    int steps = 0;
    int retval = 0;
    MPI_Comm    comm = MPI_COMM_SELF;

    adios_read_init_method (ADIOS_READ_METHOD_BP, comm, "verbose=3");
    printf ("\n--------- Read all instances of the scalar 'O'  ------------\n");
    f = adios_read_open_file (fname, ADIOS_READ_METHOD_BP, comm);
    if (f == NULL) {
        printf ("Error at opening file: %s\n", adios_errmsg());
        retval = adios_errno;
    }
    else
    {
        /* Read the scalar O with writeblock selection */
        print_scalar (f, "O");
        adios_read_close (f);
    }
    adios_read_finalize_method (ADIOS_READ_METHOD_BP);
    return retval;
}
Exemplo n.º 6
0
/* Makes a random polynomial of degree degree.		*
 * The result may be the zero polynomial!		*/
static struct polynomial make_initial_pol(unsigned int degree, int print)
{
	unsigned int a1, a2, a3, a4;
	int c;
	struct polynomial uit;
	struct term *uitterm;
	struct term **ptrterm;
	uitterm = NULL;
	uit.degree = degree;
	uit.leading = NULL;

	if (!count_sum(degree)) {
		printf("No monomials of degree %d! Stop.\n", degree);
		exit(1);
	}

	for (a1 = 0; (d1*a1 <= degree);a1++) {
	  for (a2 = 0; (d1*a1 + d2*a2 <= degree);a2++) {
	    for (a3 = 0; (d1*a1 + d2*a2 + d3*a3 <= degree);a3++) {
	      if ((degree - (a1*d1 + a2*d2 + a3*d3)) % d4 == 0) {
		a4 = (degree - (a1*d1 + a2*d2 + a3*d3))/d4;
		/* Dummy input at first. */
		c = 1;
		/* Create the new term to be put in. */
		make_term(&uitterm);
		uitterm->n1 = a1;
		uitterm->n2 = a2;
		uitterm->n3 = a3;
		uitterm->n4 = a4;
		uitterm->c = c;
		ptrterm = &(uit.leading);
		while ((*ptrterm) && (kleiner(uitterm, *ptrterm) == KLEINER)) {
			ptrterm = &((*ptrterm)->next);
		}
		uitterm->next = *ptrterm;
		*ptrterm = uitterm;
		uitterm = NULL;
	      }
	    }
	  }
	}
	if (print) {
		uitterm = uit.leading;
		while (uitterm) {
			a1 = uitterm->n1;
			a2 = uitterm->n2;
			a3 = uitterm->n3;
			a4 = uitterm->n4;
			c = 0;
			printf("Coefficient of   ");
			if (a1) {
				printf("x^%d", a1);
				c++;
			}
			if ((a1) && (a2 + a3 + a4)) {
				printf(" * ");
				c++;
			}
			if (a2) {
				printf("y^%d", a2);
				c++;
			}
			if ((a2) && (a3 + a4)) {
				printf(" * ");
				c++;
			}
			if (a3) {
				printf("z^%d", a3);
				c++;
			}
			if ((a3) && (a4)) {
				printf(" * ");
				c++;
			}
			if (a4) {
				printf("w^%d", a4);
				c++;
			}
			while (8 - c) {
				printf("   ");
				c++;
			}
			printf("= ");
			print_scalar(uitterm->c);
			printf("\n");
			uitterm = uitterm->next;
		}
	}
	return(uit);
}
Exemplo n.º 7
0
Arquivo: planner.c Projeto: ADTL/TinyG
static void _dump_plan_buffer(mpBuf_t *bf)
{
	fprintf_P(stderr, PSTR("***Runtime Buffer[%d] bstate:%d  mtype:%d  mstate:%d  replan:%d\n"),
			_get_buffer_index(bf),
			bf->buffer_state,
			bf->move_type,
			bf->move_state,
			bf->replannable);

	print_scalar(PSTR("line number:     "), bf->linenum);
	print_vector(PSTR("position:        "), mm.position, AXES);
	print_vector(PSTR("target:          "), bf->target, AXES);
	print_vector(PSTR("unit:            "), bf->unit, AXES);
	print_scalar(PSTR("jerk:            "), bf->jerk);
	print_scalar(PSTR("time:            "), bf->time);
	print_scalar(PSTR("length:          "), bf->length);
	print_scalar(PSTR("head_length:     "), bf->head_length);
	print_scalar(PSTR("body_length:     "), bf->body_length);
	print_scalar(PSTR("tail_length:     "), bf->tail_length);
	print_scalar(PSTR("entry_velocity:  "), bf->entry_velocity);
	print_scalar(PSTR("cruise_velocity: "), bf->cruise_velocity);
	print_scalar(PSTR("exit_velocity:   "), bf->exit_velocity);
	print_scalar(PSTR("exit_vmax:       "), bf->exit_vmax);
	print_scalar(PSTR("entry_vmax:      "), bf->entry_vmax);
	print_scalar(PSTR("cruise_vmax:     "), bf->cruise_vmax);
	print_scalar(PSTR("delta_vmax:      "), bf->delta_vmax);
	print_scalar(PSTR("braking_velocity:"), bf->braking_velocity);
}