//Parse the NMEA String int parse_nmea(char *in_sent){ int i = 0; char* token; //Error case for string. Check sentence token if (!tag_check(in_sent)){ printf("Error, no appropriate NMEA tag.\n"); return -1; } else{ //Begin parsing in full // get the first token token = strtok_single(in_sent, ","); gps_data[0] = token; /* walk through other tokens */ //The first call you use a char array which has the elements you want parsed. //The second time you call it you pass it NULL as the first parameter to tell function //to resume from the last spot in the string. Once the first call is made your char //array receives the parsed string. If you don't put NULL you would lose your place //and effectivly the last part of your string. while(token) { i++; token = strtok_single(NULL, ","); //printf( "%d, %s\n", i, token); gps_data[i] = token; } for(i =0; i<13;i++) printf("%d: %s\n", i, gps_data[i]); } return 0; }
static void single_thread_tests(bool long_run) { int i; printv(1, "starting single_thread_tests: %d allocated, preempt %d\n", nr_allocated, preempt_count); multiorder_checks(); rcu_barrier(); printv(2, "after multiorder_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); tag_check(); rcu_barrier(); printv(2, "after tag_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); gang_check(); rcu_barrier(); printv(2, "after gang_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); add_and_check(); rcu_barrier(); printv(2, "after add_and_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); dynamic_height_check(); rcu_barrier(); printv(2, "after dynamic_height_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); idr_checks(); ida_tests(); rcu_barrier(); printv(2, "after idr_checks: %d allocated, preempt %d\n", nr_allocated, preempt_count); big_gang_check(long_run); rcu_barrier(); printv(2, "after big_gang_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); for (i = 0; i < (long_run ? 2000 : 3); i++) { copy_tag_check(); printv(2, "%d ", i); fflush(stdout); } rcu_barrier(); printv(2, "after copy_tag_check: %d allocated, preempt %d\n", nr_allocated, preempt_count); }
static void single_thread_tests(void) { int i; tag_check(); printf("after tag_check: %d allocated\n", nr_allocated); gang_check(); printf("after gang_check: %d allocated\n", nr_allocated); add_and_check(); printf("after add_and_check: %d allocated\n", nr_allocated); dynamic_height_check(); printf("after dynamic_height_check: %d allocated\n", nr_allocated); big_gang_check(); printf("after big_gang_check: %d allocated\n", nr_allocated); for (i = 0; i < 2000; i++) { copy_tag_check(); printf("%d ", i); fflush(stdout); } printf("after copy_tag_check: %d allocated\n", nr_allocated); }