Пример #1
0
void structPolygon :: v_writeText (MelderFile file) {
	texputi4 (file, our numberOfPoints, U"numberOfPoints", 0,0,0,0,0);
	for (long i = 1; i <= our numberOfPoints; i ++) {
		texputr4 (file, our x [i], U"x [", Melder_integer (i), U"]", 0,0,0);
		texputr4 (file, our y [i], U"y [", Melder_integer (i), U"]", 0,0,0);
	}
}
Пример #2
0
void structCategories :: v_writeText (MelderFile file) {
	texputi4 (file, size, U"size", 0, 0, 0, 0, 0);
	for (long i = 1; i <= size; i++) {
		SimpleString data = (SimpleString) item [i];
		texputintro (file, U"item" " [", Melder_integer (i), U"]:", nullptr, nullptr, nullptr);
		data -> structSimpleString :: v_writeText (file);
		texexdent (file);
	}
}
void structTableOfReal :: v_writeText (MelderFile file) {
	texputi4 (file, numberOfColumns, L"numberOfColumns", 0,0,0,0,0);
	MelderFile_write (file, L"\ncolumnLabels []: ");
	if (numberOfColumns < 1) MelderFile_write (file, L"(empty)");
	MelderFile_write (file, L"\n");
	for (long i = 1; i <= numberOfColumns; i ++) {
		fprintquotedstring (file, columnLabels [i]);
		MelderFile_writeCharacter (file, '\t');
	}
	texputi4 (file, numberOfRows, L"numberOfRows", 0,0,0,0,0);
	for (long i = 1; i <= numberOfRows; i ++) {
		MelderFile_write (file, L"\nrow [", Melder_integer (i), L"]: ");
		fprintquotedstring (file, rowLabels [i]);
		for (long j = 1; j <= numberOfColumns; j ++) {
			double x = data [i] [j];
			MelderFile_write (file, L"\t", Melder_double (x));
		}
	}
}
Пример #4
0
void structTransition :: v_writeText (MelderFile file) {
	texputi4 (file, numberOfStates, L"numberOfStates", 0,0,0,0,0);
	MelderFile_write1 (file, L"\nstateLabels []: ");
	if (numberOfStates < 1) MelderFile_write1 (file, L"(empty)");
	MelderFile_write1 (file, L"\n");
	for (long i = 1; i <= numberOfStates; i ++) {
		MelderFile_write1 (file, L"\"");
		if (stateLabels [i] != NULL) MelderFile_write1 (file, stateLabels [i]);
		MelderFile_write1 (file, L"\"\t");
	}
	for (long i = 1; i <= numberOfStates; i ++) {
		MelderFile_write3 (file, L"\nstate [", Melder_integer (i), L"]:");
		for (long j = 1; j <= numberOfStates; j ++) {
			MelderFile_write2 (file, L"\t", Melder_double (data [i] [j]));
		}
	}
}
Пример #5
0
void structTransition :: v_writeText (MelderFile file) {
	texputi4 (file, numberOfStates, U"numberOfStates", 0,0,0,0,0);
	MelderFile_write (file, U"\nstateLabels []: ");
	if (numberOfStates < 1) MelderFile_write (file, U"(empty)");
	MelderFile_write (file, U"\n");
	for (long i = 1; i <= numberOfStates; i ++) {
		MelderFile_write (file, U"\"");
		if (stateLabels [i]) MelderFile_write (file, stateLabels [i]);
		MelderFile_write (file, U"\"\t");
	}
	for (long i = 1; i <= numberOfStates; i ++) {
		MelderFile_write (file, U"\nstate [", i, U"]:");
		for (long j = 1; j <= numberOfStates; j ++) {
			MelderFile_write (file, U"\t", data [i] [j]);
		}
	}
}
Пример #6
0
void _CollectionOfDaata_v_writeText (_CollectionOfDaata* me, MelderFile file) {
	texputi4 (file, my size, U"size", 0,0,0,0,0);
	texputintro (file, U"item []: ", my size ? nullptr : U"(empty)", 0,0,0,0);
	for (long i = 1; i <= my size; i ++) {
		Daata thing = my at [i];
		ClassInfo classInfo = thing -> classInfo;
		texputintro (file, U"item [", Melder_integer (i), U"]:", 0,0,0);
		if (! Thing_isa (thing, classDaata) || ! Data_canWriteText (thing))
			Melder_throw (U"Objects of class ", classInfo -> className, U" cannot be written.");
		texputw2 (file,
			classInfo -> version > 0 ?
				Melder_cat (classInfo -> className, U" ", classInfo -> version) :
				classInfo -> className,
			U"class", 0,0,0,0,0);
		texputw2 (file, thing -> name, U"name", 0,0,0,0,0);
		Data_writeText (thing, file);
		texexdent (file);
	}
	texexdent (file);
}