Page 1 of 1

Error message on empty string in Dialog.MapString.

Posted: Wed May 03, 2017 5:43 pm
by Zinn
An empty strings (e.g. "#Ctls:") produce an error messages ("key not found" ) in Dialog.MapString
by logMissingSimpleKeys = TRUE.

Im module Dialog should be the procedure SearchString(in, out)

Code: Select all

			i := 0; ch := in[1];
			WHILE (ch # 0X) (* & (ch # ".") *) & (ch # ":") DO subsys[i] := ch; INC(i); ch := in[i + 1] END;
			subsys[i] := 0X;
			IF ch # 0X THEN
				INC(i, 2); ch := in[i]; j := 0;
				WHILE (ch # 0X) DO in[j] := ch; INC(i); INC(j); ch := in[i] END;
				in[j] := 0X
			ELSE
				RETURN
			END;
add IF ch # 0X THEN INC(i); ch := in[i+1] END; and change INC(i, 2) to INC(i)

Code: Select all

			i := 0; ch := in[1];
			WHILE (ch # 0X) (* & (ch # ".") *) & (ch # ":") DO subsys[i] := ch; INC(i); ch := in[i + 1] END;
			subsys[i] := 0X;
			IF ch # 0X THEN INC(i); ch := in[i+1] END;
			IF ch # 0X THEN
				INC(i); ch := in[i]; j := 0;
				WHILE (ch # 0X) DO in[j] := ch; INC(i); INC(j); ch := in[i] END;
				in[j] := 0X
			ELSE
				RETURN
			END;
That solves the problem and do a RETURN on empty string.

Re: Error message on empty string in Dialog.MapString.

Posted: Thu May 04, 2017 5:32 am
by Josef Templ
I agree. This should be turned into an issue.
It is currently not possible to insert an empty key into the Strings resource file, thus
an empty key should not be treated as missing. The alternative, supporting empty keys in
Strings resources, does also not look attractive and may cause more complications.

The surrounding code is a bit complicated. A slight improvement may be:

Code: Select all

			WHILE (ch # 0X) & (ch # ":") DO subsys[i] := ch; INC(i); ch := in[i + 1] END;
			subsys[i] := 0X;
			IF ch = ":" THEN INC(i); ch := in[i + 1] END;
			IF ch = 0X THEN (* no key *) RETURN END;
			INC(i); ch := in[i]; j := 0;
			WHILE (ch # 0X) DO in[j] := ch; INC(i); INC(j); ch := in[i] END; (* in := key *)
			in[j] := 0X;
Is there also a problem with empty subsystem names?

- Josef

Re: Error message on empty string in Dialog.MapString.

Posted: Fri May 05, 2017 5:55 am
by Zinn
Josef, your solution is much better.
Josef Templ wrote: Is there also a problem with empty subsystem names?
Wrong and missing subsytem names are no problem (e.g. "", " ", "#Ctls", "Ctls:") then out is equal in.
Except: Only if the subsystem name is equal "#:" produces 2 illegal execution (adr = 66312AD4H) traps in the application module.
- Helmut

Re: Error message on empty string in Dialog.MapString.

Posted: Mon Oct 09, 2017 8:33 am
by Robert
Helmut
What is the status of this topic? Does an issue need to be raised, or can this topic be moved to 'Resolved' or 'Rejected'?

Re: Error message on empty string in Dialog.MapString.

Posted: Mon Oct 09, 2017 9:03 am
by Josef Templ
I think this has been solved by issue-#161.

- Josef