int main(int argc, char **argv) { size_t i; int bits; struct mg_data_raw_t *p = mg_data_raw; if (argc < 4 || argv[1][0] == '\0' || argv[2][0] == '\0' || argv[3][0] == '\0') { fprintf(stderr, "Usage: %s uudemap.h bitcount.h mg_data.h\n", argv[0]); return 1; } for (i = 0; i < sizeof(PL_uuemap) - 1; ++i) PL_uudmap[(U8)PL_uuemap[i]] = (char)i; /* * Because ' ' and '`' map to the same value, * we need to decode them both the same. */ PL_uudmap[(U8)' '] = 0; output_to_file(argv[0], argv[1], &format_char_block, (const void *)PL_uudmap, sizeof(PL_uudmap)); for (bits = 1; bits < 256; bits++) { if (bits & 1) PL_bitcount[bits]++; if (bits & 2) PL_bitcount[bits]++; if (bits & 4) PL_bitcount[bits]++; if (bits & 8) PL_bitcount[bits]++; if (bits & 16) PL_bitcount[bits]++; if (bits & 32) PL_bitcount[bits]++; if (bits & 64) PL_bitcount[bits]++; if (bits & 128) PL_bitcount[bits]++; } output_to_file(argv[0], argv[2], &format_char_block, (const void *)PL_bitcount, sizeof(PL_bitcount)); while (p->value) { mg_data[p->type].value = p->value; mg_data[p->type].comment = p->comment; ++p; } output_to_file(argv[0], argv[3], &format_mg_data, (const void *)mg_data, sizeof(mg_data)/sizeof(mg_data[0])); return 0; }
void driver() { double xn1 = x; double yn1 = y; double time = 0.0; if(output_to_file(time, x_init, y_init)) //Writing initial values to output file exit(EXIT_FAILURE); for (time = h; time <= range && x >0 && y>0; time += h) { x_or_y = 1; xn1 = runge_kutta(x,time, h); x_or_y = 0; yn1 = runge_kutta(y,time, h); if(output_to_file(time, xn1, yn1)) exit(EXIT_FAILURE); x = xn1; y = yn1; } }