Index: cpp/frams/genetics/geno.cpp
===================================================================
--- cpp/frams/genetics/geno.cpp	(revision 529)
+++ cpp/frams/genetics/geno.cpp	(revision 530)
@@ -29,7 +29,14 @@
 	owner = 0;
 	f0gen = 0;
+	isvalid = -1;
+	name = genname;
+	txt = comment;
+	setGeneAndFormat(genstring,genformat);
+}
+
+void Geno::setGeneAndFormat(const SString& genstring, char genformat)
+{
 	mapinshift = 0;
 	mapoutshift = 0;
-	isvalid = -1;
 	SString gencopy(genstring);
 	if (genformat == -1)
@@ -43,12 +50,11 @@
 			case '/':
 				genformat = genstring.charAt(2);
-				if ((genformat == '\0') || isspace(genformat))
-					genformat = INVALID_FORMAT;
 				if ((end = genstring.indexOf('\n')) >= 0)
 				{
+					mapinshift = end + 1;
+					gencopy = genstring.substr(end + 1);
+					if ((end>0) && (genstring[end-1]=='\r')) end--;
 					error_end = end;
 					if (end != 3) genformat = INVALID_FORMAT;
-					gencopy = genstring.substr(end + 1);
-					mapinshift = end + 1;
 				}
 				else
@@ -61,6 +67,4 @@
 			case '*':
 				genformat = genstring.charAt(2);
-				if ((genformat == '\0') || isspace(genformat))
-					genformat = INVALID_FORMAT;
 				if ((end = genstring.indexOf("*/")) >= 0)
 				{
@@ -78,4 +82,5 @@
 				break;
 			}
+			if (!isalnum(genformat)) genformat=INVALID_FORMAT;
 			if (genformat == INVALID_FORMAT)
 			{
@@ -88,16 +93,16 @@
 					cut = genstring.substr(0, error_end);
 				int lf = cut.indexOf('\n');
-				if (lf >= 0) cut = cut.substr(0, lf);
-				logPrintf("Geno", "init", LOG_ERROR, "Invalid genotype format declaration: '%s'%s", cut.c_str(), genname.len() ? SString::sprintf(" in '%s'", genname.c_str()).c_str() : "");
+				if (lf >= 0) { if ((lf>0)&&(cut[lf-1]=='\r')) lf--; cut = cut.substr(0, lf); }
+				sstringQuote(cut);
+				logPrintf("Geno", "init", LOG_ERROR, "Invalid genotype format declaration: '%s'%s", cut.c_str(), name.len() ? SString::sprintf(" in '%s'", name.c_str()).c_str() : "");
 			}
 
 		}
 	}
-
 	gen = gencopy;
+	multiline = (strchr(gen.c_str(), '\n') != 0);
 	format = genformat;
-	name = genname;
-	txt = comment;
-	multiline = (strchr(gen.c_str(), '\n') != 0);
+	freeF0();
+	isvalid = -1;
 	// mapoutshift...?
 }
@@ -146,10 +151,9 @@
 }
 
-void Geno::setGene(const SString& g, char newformat)
+void Geno::setGeneOnly(const SString& g)
 {
 	gen = g;
 	isvalid = -1;
 	freeF0();
-	if (newformat >= 0) format = newformat;
 }
 
@@ -170,30 +174,5 @@
 }
 
-SString Geno::toString(void) const
-{
-	SString out;
-	int comment = 0;
-	if ((format != '1') || (comment = (txt.len() || name.len())))
-	{
-		if (multiline)
-			out += "//";
-		else
-			out += "/*";
-		out += format;
-		if (comment)
-		{
-			if (txt.len()) { out += ";"; out += txt; }
-			if (name.len()){ out += ";"; out += name; }
-		}
-		if (multiline)
-			out += "\n";
-		else
-			out += "*/";
-	}
-	out += gen;
-	return out;
-}
-
-SString Geno::shortString(void) const
+SString Geno::getGeneAndFormat(void) const
 {
 	SString out;
Index: cpp/frams/genetics/geno.h
===================================================================
--- cpp/frams/genetics/geno.h	(revision 529)
+++ cpp/frams/genetics/geno.h	(revision 530)
@@ -55,5 +55,5 @@
 
 public:
-	static const int INVALID_FORMAT = '!';
+	static const char INVALID_FORMAT = '!';
 	typedef SListTempl<GenoValidator*> Validators;
 
@@ -85,11 +85,12 @@
 
 	/// return string representation, with format comment at the beginning
-	SString toString(void) const;
-	SString shortString(void) const;
+	SString getGeneAndFormat(void) const;
 
 	void setString(const SString& genewithcomments);
 
-	/** @param newformat=-1 -> don't change */
-	void setGene(const SString& g, char newformat = -1);
+	/** @param genformat=-1 -> take from genstring comment (like the constructor) else specify the valid format in genformat and pure gene in genstring */
+	void setGeneAndFormat(const SString& genstring, char genformat=-1);
+	/** g must be pure gene, without format. for the standard behavior use setGeneAndFormat() */
+	void setGeneOnly(const SString& g);
 	SString getGene(void) const;
 
