Index: cpp/frams/param/param.cpp
===================================================================
--- cpp/frams/param/param.cpp	(revision 310)
+++ cpp/frams/param/param.cpp	(revision 312)
@@ -52,8 +52,8 @@
 			&& (*type(i) != 'p'))
 		{
-			j = src->findId(id(i));
-			if (j < 0) continue;
-			src->get(j, v);
-			set(i, v);
+		j = src->findId(id(i));
+		if (j < 0) continue;
+		src->get(j, v);
+		set(i, v);
 		}
 }
@@ -67,6 +67,6 @@
 			&& (*type(i) != 'p'))
 		{
-			src->get(i, v);
-			set(i, v);
+		src->get(i, v);
+		set(i, v);
 		}
 }
@@ -90,24 +90,24 @@
 	const char* t = type(prop) + 1;
 	while (*t) if (*t == ' ') break; else t++;
-	int ret=sscanf(t, "%d %d", &minumum, &maximum);
-	def=SString::empty();
-	if (ret==2)
-		{
-		while (*t==' ') t++;
-		for(int skip_fields=2;skip_fields>0;skip_fields--)
-			{
+	int ret = sscanf(t, "%d %d", &minumum, &maximum);
+	def = SString::empty();
+	if (ret == 2)
+	{
+		while (*t == ' ') t++;
+		for (int skip_fields = 2; skip_fields > 0; skip_fields--)
+		{
 			while (*t) if (*t == ' ') break; else t++;
-			while (*t==' ') t++;
-			}
+			while (*t == ' ') t++;
+		}
 		if (*t)
-			{
-			const char* end=strchr(t,'~');
+		{
+			const char* end = strchr(t, '~');
 			if (!end)
-				end=t+strlen(t);
-			while ((end>t)&&(end[-1]==' ')) end--;
-			def=SString(t,end-t);
-			}
+				end = t + strlen(t);
+			while ((end > t) && (end[-1] == ' ')) end--;
+			def = SString(t, end - t);
+		}
 		return 3;
-		}
+	}
 	else
 		return ret;
@@ -151,16 +151,18 @@
 	}
 		break;
-        case 's': case 'x':
-	{
-		int a,b; SString c;
-		getMinMax(i,a,b,c);
-		if (*t=='s')
-			setString(i,c);
+	case 's': case 'x':
+	{
+		int a, b; SString c;
+		getMinMax(i, a, b, c);
+		if (*t == 's')
+			setString(i, c);
 		else
-			{ if (c.len()>0) setExtValue(i,ExtValue(c)); else setExtValue(i,ExtValue::empty()); }
-        }
+		{
+			if (c.len() > 0) setExtValue(i, ExtValue(c)); else setExtValue(i, ExtValue::empty());
+		}
+	}
 		break;
 	case 'o':
-		setObject(i,ExtObject::empty());
+		setObject(i, ExtObject::empty());
 		break;
 	}
@@ -214,26 +216,48 @@
 
 SString ParamInterface::getStringById(const char*prop)
-{int i=findId(prop); if (i>=0) return getString(i); else return SString();}
+{
+	int i = findId(prop); if (i >= 0) return getString(i); else return SString();
+}
 paInt ParamInterface::getIntById(const char*prop)
-{int i=findId(prop); if (i>=0) return getInt(i); else return 0;}
+{
+	int i = findId(prop); if (i >= 0) return getInt(i); else return 0;
+}
 double ParamInterface::getDoubleById(const char*prop)
-{int i=findId(prop); if (i>=0) return getDouble(i); else return 0;}
+{
+	int i = findId(prop); if (i >= 0) return getDouble(i); else return 0;
+}
 ExtObject ParamInterface::getObjectById(const char*prop)
-{int i=findId(prop); if (i>=0) return getObject(i); else return ExtObject();}
+{
+	int i = findId(prop); if (i >= 0) return getObject(i); else return ExtObject();
+}
 ExtValue ParamInterface::getExtValueById(const char*prop)
-{int i=findId(prop); if (i>=0) return getExtValue(i); else return ExtValue();}
-
-int ParamInterface::setIntById(const char* prop,paInt v)
-{int i=findId(prop); if (i>=0) return setInt(i,v); else return PSET_NOPROPERTY;}
-int ParamInterface::setDoubleById(const char* prop,double v)
-{int i=findId(prop); if (i>=0) return setDouble(i,v); else return PSET_NOPROPERTY;}
-int ParamInterface::setStringById(const char* prop,const SString &v)
-{int i=findId(prop); if (i>=0) return setString(i,v); else return PSET_NOPROPERTY;}
-int ParamInterface::setObjectById(const char* prop,const ExtObject &v)
-{int i=findId(prop); if (i>=0) return setObject(i,v); else return PSET_NOPROPERTY;}
-int ParamInterface::setExtValueById(const char* prop,const ExtValue &v)
-{int i=findId(prop); if (i>=0) return setExtValue(i,v); else return PSET_NOPROPERTY;}
-int ParamInterface::setById(const char* prop,const ExtValue &v)
-{int i=findId(prop); if (i>=0) return set(i,v); else return PSET_NOPROPERTY;}
+{
+	int i = findId(prop); if (i >= 0) return getExtValue(i); else return ExtValue();
+}
+
+int ParamInterface::setIntById(const char* prop, paInt v)
+{
+	int i = findId(prop); if (i >= 0) return setInt(i, v); else return PSET_NOPROPERTY;
+}
+int ParamInterface::setDoubleById(const char* prop, double v)
+{
+	int i = findId(prop); if (i >= 0) return setDouble(i, v); else return PSET_NOPROPERTY;
+}
+int ParamInterface::setStringById(const char* prop, const SString &v)
+{
+	int i = findId(prop); if (i >= 0) return setString(i, v); else return PSET_NOPROPERTY;
+}
+int ParamInterface::setObjectById(const char* prop, const ExtObject &v)
+{
+	int i = findId(prop); if (i >= 0) return setObject(i, v); else return PSET_NOPROPERTY;
+}
+int ParamInterface::setExtValueById(const char* prop, const ExtValue &v)
+{
+	int i = findId(prop); if (i >= 0) return setExtValue(i, v); else return PSET_NOPROPERTY;
+}
+int ParamInterface::setById(const char* prop, const ExtValue &v)
+{
+	int i = findId(prop); if (i >= 0) return set(i, v); else return PSET_NOPROPERTY;
+}
 
 int ParamInterface::save(VirtFILE* f, const char* altname, bool force)
@@ -270,5 +294,5 @@
 	err |= (fputs(p, f) == EOF); fputc(':', f);
 	cr = 0;
-	if ((*typ == 'x')||(*typ == 'o'))
+	if ((*typ == 'x') || (*typ == 'o'))
 	{
 		ExtValue ex;
@@ -332,36 +356,36 @@
 		if (!((fl = flags(i))&PARAM_DONTSAVE))
 		{
-			if (defdata && isequal(i, defdata))
-				needlabel = 1;
-			else
-			{
-				if (!first) t += ", ";
+		if (defdata && isequal(i, defdata))
+			needlabel = 1;
+		else
+		{
+			if (!first) t += ", ";
 #ifndef SAVE_ALL_NAMES
 #ifdef SAVE_SELECTED_NAMES
-				if (needlabel || all_names || !(fl & PARAM_CANOMITNAME))
+			if (needlabel || all_names || !(fl & PARAM_CANOMITNAME))
 #else
-				if (needlabel)
+			if (needlabel)
 #endif
 #endif
+			{
+				t += p; t += "="; needlabel = 0;
+			}
+			if (type(i)[0] == 's')
+			{ // string - special case
+				SString str = getString(i);
+				if (strContainsOneOf(str, ", \\\n\r\t\""))
 				{
-					t += p; t += "="; needlabel = 0;
-				}
-				if (type(i)[0] == 's')
-				{ // string - special case
-					SString str = getString(i);
-					if (strContainsOneOf(str, ", \\\n\r\t\""))
-					{
-						t += "\"";
-						sstringQuote(str);
-						t += str;
-						t += "\"";
-					}
-					else
-						t += str;
+					t += "\"";
+					sstringQuote(str);
+					t += str;
+					t += "\"";
 				}
 				else
-					t += get(i);
-				first = 0;
+					t += str;
 			}
+			else
+				t += get(i);
+			first = 0;
+		}
 		}
 	if (addcr)
@@ -370,5 +394,5 @@
 }
 
-int ParamInterface::load(VirtFILE* f,bool warn_unknown_fields,bool *abortable)
+int ParamInterface::load(VirtFILE* f, bool warn_unknown_fields, bool *abortable)
 {
 	SString buf;
@@ -378,10 +402,10 @@
 	bool loaded;
 	int fields_loaded = 0;
-	while ( ((!abortable)||(!*abortable)) && loadSStringLine(f, buf) )
+	while (((!abortable) || (!*abortable)) && loadSStringLine(f, buf))
 	{
 		const char* t = (const char*)buf;
 		p0 = t; while ((*p0 == ' ') || (*p0 == '\t')) p0++;
 		if (!*p0) break;
-		if (p0[0]=='#') continue;
+		if (p0[0] == '#') continue;
 		p = strchr(p0, ':'); if (!p) continue;
 		p_len = (int)(p - p0);
@@ -389,28 +413,28 @@
 		if (p_len && ((i = findIdn(p0, p_len)) >= 0))
 		{
-		if (!(flags(i)&PARAM_DONTLOAD))
-		   {
-			if (p0[p_len + 1] == '~')
+			if (!(flags(i)&PARAM_DONTLOAD))
 			{
-				SString s;
-				czytdotyldy(f, s);
-				removeCR(s);
-				int ch; while ((ch = fgetc(f)) != EOF) if (ch == '\n') break;
-				unquoteTilde(s);
-				set(i, (const char*)s);
+				if (p0[p_len + 1] == '~')
+				{
+					SString s;
+					czytdotyldy(f, s);
+					removeCR(s);
+					int ch; while ((ch = fgetc(f)) != EOF) if (ch == '\n') break;
+					unquoteTilde(s);
+					set(i, (const char*)s);
+				}
+				else
+				{
+					set(i, p0 + p_len + 1);
+				}
+				fields_loaded++;
+				loaded = true;
 			}
-			else
-			{
-				set(i, p0 + p_len + 1);
-			}
-			fields_loaded++;
-			loaded = true;
-		   }
 		}
 		else if (warn_unknown_fields)
-			{
-			SString name(p0,p_len);
-			FMprintf("ParamInterface","load",FMLV_WARN,"Unknown property '%s' while reading object '%s' (ignored)",(const char*)name,getName());
-			}
+		{
+			SString name(p0, p_len);
+			FMprintf("ParamInterface", "load", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", (const char*)name, getName());
+		}
 
 		if ((!loaded) && (p0[p_len + 1] == '~'))
@@ -430,20 +454,20 @@
 char *t;
 switch (*(t=type(i)))
-	{
+{
 	case 'd':
 	{
-	for (i=atol(get(i));i>=0;i--) if (t) t=strchr(t+1,'~');
-	if (t)
-		{
-		t++;
-		char *t2=strchr(t,'~');
-		if (!t2) t2=t+strlen(t);
-		SString str;
-		strncpy(str.directWrite(t2-t),t,t2-t);
-		str.endWrite(t2-t);
-		return str;
-		}
-	}
-	}
+		for (i=atol(get(i));i>=0;i--) if (t) t=strchr(t+1,'~');
+		if (t)
+		{
+			t++;
+			char *t2=strchr(t,'~');
+			if (!t2) t2=t+strlen(t);
+			SString str;
+			strncpy(str.directWrite(t2-t),t,t2-t);
+			str.endWrite(t2-t);
+			return str;
+		}
+	}
+}
 return get(i);
 }
@@ -543,5 +567,5 @@
 int ParamInterface::set(int i, const char *v)
 {
-	char typ=type(i)[0];
+	char typ = type(i)[0];
 	switch (typ)
 	{
@@ -567,5 +591,5 @@
 			e.setString(SString(v));
 		}
-		if (typ=='x')
+		if (typ == 'x')
 			return setExtValue(i, e);
 		else
@@ -581,13 +605,13 @@
 	if ((*(t = type(i))) == 'd')
 	{
-		paInt a,b,c;
-		int value=getInt(i);
-		if (getMinMax(i,a,b,c)>=2)
-			{
-			if (value>b)
+		paInt a, b, c;
+		int value = getInt(i);
+		if (getMinMax(i, a, b, c) >= 2)
+		{
+			if (value > b)
 				return get(i);
-			value-=a;
-			}
-		if (value<0) return get(i);
+			value -= a;
+		}
+		if (value < 0) return get(i);
 		for (; value >= 0; value--) if (t) t = strchr(t + 1, '~');
 		if (t)
@@ -621,25 +645,25 @@
 void SimpleAbstractParam::sanityCheck(int i)
 {
-ParamEntry *pe=entry(i);
-
-const char* t=pe->type;
-const char* err=NULL;
-
-if (*t=='p')
-	{
-	if (pe->fun1==NULL)
-		err="no procedure defined";
-	}
-else
-	{
-	if (!(pe->flags & PARAM_READONLY))
+	ParamEntry *pe=entry(i);
+
+	const char* t=pe->type;
+	const char* err=NULL;
+
+	if (*t=='p')
+	{
+		if (pe->fun1==NULL)
+			err="no procedure defined";
+	}
+	else
+	{
+		if (!(pe->flags & PARAM_READONLY))
 		{ //write access
-		if ((pe->fun2==NULL)&&(pe->offset==PARAM_ILLEGAL_OFFSET))
-			err="no field defined (GETONLY without PARAM_READONLY?)";
-		}
-	}
-if (err!=NULL)
-	FMprintf("SimpleAbstractParam","sanityCheck", FMLV_ERROR,
-		 "Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err);
+			if ((pe->fun2==NULL)&&(pe->offset==PARAM_ILLEGAL_OFFSET))
+				err="no field defined (GETONLY without PARAM_READONLY?)";
+		}
+	}
+	if (err!=NULL)
+		FMprintf("SimpleAbstractParam","sanityCheck", FMLV_ERROR,
+		"Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err);
 }	
 #endif
@@ -761,6 +785,6 @@
 		if (a <= b) // if max<min then the min/max constraint check is not supported
 		{
-			if (x<a) { x = a; result = PSET_HITMIN; }
-			else if (x>b) { x = b; result = PSET_HITMAX; }
+		if (x < a) { x = a; result = PSET_HITMIN; }
+		else if (x > b) { x = b; result = PSET_HITMAX; }
 		}
 
@@ -797,6 +821,6 @@
 		if (a <= b) // if max<min then the min/max constraint check is not supported
 		{
-			if (x<a) { x = a; result = PSET_HITMIN; }
-			else if (x>b) { x = b; result = PSET_HITMAX; }
+		if (x < a) { x = a; result = PSET_HITMIN; }
+		else if (x > b) { x = b; result = PSET_HITMAX; }
 		}
 
@@ -973,5 +997,5 @@
 	{
 		// processing a single field
-		while (strchr(" \n\r\t", *t)) if (t<end) t++; else return fields_loaded;
+		while (strchr(" \n\r\t", *t)) if (t < end) t++; else return fields_loaded;
 
 		comma_sign = strchrlimit(t, ',', end); if (!comma_sign) comma_sign = end;
@@ -980,5 +1004,5 @@
 		{
 			quote2 = skipQuoteString(quote + 1, end);
-			if (quote2>comma_sign)
+			if (quote2 > comma_sign)
 			{
 				comma_sign = strchrlimit(quote2 + 1, ',', end);
@@ -1003,8 +1027,8 @@
 			i = tmpi;
 			if (tmpi < 0)
-				{
-				SString name(t,(int)(equals_sign - t));
-				FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)",(const char*)name,getName());
-				}
+			{
+				SString name(t, (int)(equals_sign - t));
+				FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", (const char*)name, getName());
+			}
 			t = equals_sign + 1; // t=value
 		}
@@ -1015,6 +1039,6 @@
 #endif
 			{
-				FMprintf("Param", "load2", FMLV_WARN, "Missing property name in '%s' (assuming '%s')",
-					getName(), id(i) ? id(i) : "unknown property?");
+			FMprintf("Param", "load2", FMLV_WARN, "Missing property name in '%s' (assuming '%s')",
+				getName(), id(i) ? id(i) : "unknown property?");
 			}
 #endif
