Error message on empty string in Dialog.MapString.

Post Reply
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Error message on empty string in Dialog.MapString.

Post 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.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

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

Post 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
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

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

Post 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'?
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post by Josef Templ »

I think this has been solved by issue-#161.

- Josef
Post Reply