v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Editing User talk:Jifodus/Dwarf Fortress Utility Framework
Jump to navigation
Jump to search
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | ==Sphr | + | ==From Sphr== |
− | |||
A suggestion to consider: | A suggestion to consider: | ||
Unify map type defninition so that it can be used in inline definitions as well as global references. | Unify map type defninition so that it can be used in inline definitions as well as global references. | ||
In general a map has: | In general a map has: | ||
− | |||
@name (optional) Does not need name if inlined | @name (optional) Does not need name if inlined | ||
− | @size (optional) not needed for predefined types of known size. | + | @size (optional) not needed for predefined types of known size. Optional for most cases except when used as valuetype in array/vector |
− | |||
@type (optional) name of predefined/user-defined map | @type (optional) name of predefined/user-defined map | ||
− | @(type-specific parameters) (e.g. vector/array/pointer may have a "valuetype", | + | @(type-specific parameters) (e.g. vector/array/pointer may have a "valuetype", array may also need a "length". complex will have a "mapping" of named offsets) |
− | |||
− | |||
An element in a "complex" 's "mapping" has | An element in a "complex" 's "mapping" has | ||
− | |||
@name (required) name of mapping | @name (required) name of mapping | ||
@offset (required) address offset from base of map | @offset (required) address offset from base of map | ||
@type (optional) name of predefined/user-defined map OR inlined defined type | @type (optional) name of predefined/user-defined map OR inlined defined type | ||
− | @(type-specific parameters) (e.g. vector/array/pointer may have a "valuetype", | + | @(type-specific parameters) (e.g. vector/array/pointer may have a "valuetype", array may also need a "length". complex will have a "mapping" of named offsets) |
− | + | ||
− | |||
Basically | Basically | ||
− | + | Every map definition can be used inline in another definitionwhere a "type" is expected. | |
− | + | Every named map definition can be referenced wherever a "type" is expected. | |
The following shows some examples (may contain human errors) | The following shows some examples (may contain human errors) | ||
Line 38: | Line 31: | ||
type="complex", | type="complex", | ||
mapping=[ // mapping is used only by "complex" type | mapping=[ // mapping is used only by "complex" type | ||
− | {name="buffer", offset=0x04, type="array", valuetype="byte", length="16"}, | + | {name="buffer", offset=0x04, type="array", valuetype="byte", length="16"}, // have to define length for array if arrays are used as valuetypes for other arrays/vectors |
− | + | {name="pointer", offset=0x04, type="pointer", valuetype=map{type="array", valuetype="byte"} }, // inline definintion of byte array as valuetype | |
− | {name="pointer", offset=0x04, type="pointer", valuetype=map{type="array", valuetype="byte"} }, | ||
− | |||
{name="length", offset=0x14, type="dword"}, | {name="length", offset=0x14, type="dword"}, | ||
{name="capacity", offset=0x18, type="dword"} | {name="capacity", offset=0x18, type="dword"} | ||
Line 108: | Line 99: | ||
Notice that mapping defined for the whole process is no different from that defined for a structure. The process structure is just a global structure bound to address 0x0000 of the DF process at run-time. | Notice that mapping defined for the whole process is no different from that defined for a structure. The process structure is just a global structure bound to address 0x0000 of the DF process at run-time. | ||
− | + | [[User:Sphr|Sphr]] 02:02, 13 December 2007 (EST) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |