Feature Request #1848

string codes

Added by Hirundo almost 9 years ago. Updated about 8 years ago.

Status:NewStart date:2010-11-15
Priority:LowDue date:
Assignee:-% Done:

90%

Category:-
Target version:-

Description

OpenTTD recently added some string codes that need NML support:
http://vcs.openttd.org/hg/openttd/trunk.hg/log?rev=string+codes

stringcodes.diff Magnifier (3.08 KB) Hirundo, 2011-08-21 14:07

Associated revisions

Revision 1645:8cabca851ffa
Added by yexo about 8 years ago

Change #1848: rename some string codes and duplicate a few others (Hirundo)

Revision 1645:8cabca851ffa
Added by yexo about 8 years ago

Change #1848: rename some string codes and duplicate a few others (Hirundo)

Revision 1658:f43e0307fe47
Added by yexo about 8 years ago

Feature #1848: also allow string references as static arguments for string()

Revision 1658:f43e0307fe47
Added by yexo about 8 years ago

Feature #1848: also allow string references as static arguments for string()

History

#1 Updated by yexo almost 9 years ago

  • Assignee set to yexo

Working on it, but I'm a bit low on time.

#2 Updated by yexo almost 9 years ago

  • Assignee deleted (yexo)

Most of the code done. Still todo:
- Documentation for all string codes.
- String arguments in the code.
- Think about allowing literal strings instead of String() references in a few more places, or perhaps in general?

#3 Updated by Hirundo about 8 years ago

Attached is a proposal to rename several string codes and add/remove some others. Basically, the idea is to have only one string code per formatting type (number, currency, etc), which is dword-sized when possible. Only the signed and unsigned words have been kept, so strings that need many formatting codes (FIRS debug) can use those to save some bytes.

On the implementation side, string codes may use 2 or 4 bytes. If different translations have differently sized string codes, a SKIP may be added to pad the shorter ones (in addition to emitting a warning). Skip is a no-op anyways when the text stack is not used.

'push word on stack' might be used for constant parameters, to save registers, or when using registers is not possible.
'ROTATE' has been left in for now, but I'm not too sure about it. We'd probably best come up with a better mechanism to use parameters out-of-order, if possible.

#4 Updated by yexo about 8 years ago

  • % Done changed from 0 to 90

Code needs some more documentation and more testing.

Also available in: Atom PDF