Exemple #1
0
static void save_cylinder_info(FILE *f, struct dive *dive)
{
	int i;

	for (i = 0; i < MAX_CYLINDERS; i++) {
		cylinder_t *cylinder = dive->cylinder+i;
		int volume = cylinder->type.size.mliter;
		const char *description = cylinder->type.description;
		int o2 = cylinder->gasmix.o2.permille;
		int he = cylinder->gasmix.he.permille;
		int start = cylinder->start.mbar;
		int end = cylinder->end.mbar;

		/* No cylinder information at all? */
		if (!o2 && !volume && !start && !end)
			return;
		fprintf(f, "  <cylinder");
		if (volume)
			show_milli(f, " size='", volume, " l", "'");
		show_pressure(f, cylinder->type.workingpressure, " workpressure='", "'");
		if (description && *description)
			fprintf(f, " description='%s'", description);
		if (o2) {
			fprintf(f, " o2='%u.%u%%'", FRACTION(o2, 10));
			if (he)
				fprintf(f, " he='%u.%u%%'", FRACTION(he, 10));
		}
		show_pressure(f, cylinder->start, " start='", "'");
		show_pressure(f, cylinder->end, " end='", "'");
		fprintf(f, " />\n");
	}
}
Exemple #2
0
static void save_cylinder_info(FILE *f, struct dive *dive)
{
	int i, nr;

	nr = nr_cylinders(dive);

	for (i = 0; i < nr; i++) {
		cylinder_t *cylinder = dive->cylinder+i;
		int volume = cylinder->type.size.mliter;
		const char *description = cylinder->type.description;
		int o2 = cylinder->gasmix.o2.permille;
		int he = cylinder->gasmix.he.permille;

		fprintf(f, "  <cylinder");
		if (volume)
			show_milli(f, " size='", volume, " l", "'");
		show_pressure(f, cylinder->type.workingpressure, " workpressure='", "'");
		if (description && *description)
			fprintf(f, " description='%s'", description);
		if (o2) {
			fprintf(f, " o2='%u.%u%%'", FRACTION(o2, 10));
			if (he)
				fprintf(f, " he='%u.%u%%'", FRACTION(he, 10));
		}
		show_pressure(f, cylinder->start, " start='", "'");
		show_pressure(f, cylinder->end, " end='", "'");
		fprintf(f, " />\n");
	}
}
Exemple #3
0
static void save_overview(FILE *f, struct dive *dive)
{
	show_depth(f, dive->maxdepth, "  <maxdepth>", "</maxdepth>\n");
	show_depth(f, dive->meandepth, "  <meandepth>", "</meandepth>\n");
	show_temperature(f, dive->airtemp, "  <airtemp>", "</airtemp>\n");
	show_temperature(f, dive->watertemp, "  <watertemp>", "</watertemp>\n");
	show_duration(f, dive->duration, "  <duration>", "</duration>\n");
	show_duration(f, dive->surfacetime, "  <surfacetime>", "</surfacetime>\n");
	show_pressure(f, dive->beginning_pressure, "  <cylinderstartpressure>", "</cylinderstartpressure>\n");
	show_pressure(f, dive->end_pressure, "  <cylinderendpressure>", "</cylinderendpressure>\n");
	show_utf8(f, dive->location, "  <location>","</location>\n");
	show_utf8(f, dive->notes, "  <notes>","</notes>\n");
}
Exemple #4
0
static void save_airpressure(FILE *f, struct dive *dive)
{
	if (!dive->surface_pressure.mbar)
		return;
	fputs("  <surface", f);
	show_pressure(f, dive->surface_pressure, " pressure='", "'");
	fputs(" />\n", f);
}
Exemple #5
0
static void save_sample(FILE *f, struct sample *sample)
{
	fprintf(f, "  <sample time='%u:%02u min'", FRACTION(sample->time.seconds,60));
	show_milli(f, " depth='", sample->depth.mm, " m", "'");
	show_temperature(f, sample->temperature, " temp='", "'");
	show_pressure(f, sample->cylinderpressure, " pressure='", "'");
	if (sample->cylinderindex)
		fprintf(f, " cylinderindex='%d'", sample->cylinderindex);
	fprintf(f, " />\n");
}