Index | PAL Intro | Commands | Registers | Indices | Stack | Macros | Classes | Attributes | Errors


Manual Reference Pages  - attr_def (5)

NAME

attr/def - Define encoded data value

CONTENTS

Synopsis
Description
List Sequences
Importing Values
Error Handling
Examples
See Also
Author

SYNOPSIS

attr/def write, attribute, value
attr/def write, xvalue

attr/import write, attribute, value

DESCRIPTION

Takes a given data value and encodes it according to the syntax of the given attribute, storing the result as a PSUNIT_TYPE_XVALUE in the write register.

The attribute is either a text argument containing the name of the object attribute to add, or a PSUNIT_TYPE_ATTRDEF register returned by the attr/load instruction.

The value is an argument containing the data to encode. If value is a register containing the type PSUNIT_TYPE_STRING or PSUNIT_TYPE_LIST and the instruction does not generate an error, then the register will be cleared as the byte string is now referenced elsewhere.

If value is a register containing the type PSUNIT_TYPE_XVALUE, the encoded data is duplicated in the same fashion as with the attr/direct instruction. See attr_direct(5).

If xvalue is provided as the second argument and the value is omitted, then the encoded value is duplicated in the resulting write register.

LIST SEQUENCES

If value is a list sequence provided via @[ ... ] notation and the list contained registers of type PSUNIT_TYPE_STRING or PSUNIT_TYPE_XVALUE, then upon successful completion of this instruction the source registers will be cleared as the data is now referenced elsewhere.

IMPORTING VALUES

The attr/import instruction is identical to attr/def except that value must be binary data represented as a PSUNIT_TYPE_STRING and previously exported from the same attribute type with attr/export.

ERROR HANDLING

A runtime error is generated if an argument is of the wrong type, or if a named attribute does not exist in the schema.

EXAMPLES

attr/def P7, [psIndex], #53
  Creates an encoded data value using the psIndex attribute syntax for the numeric value 53. The result will be stored in the register P7.
attr/def PUSH, [psString], P7
  Re-encode the encoded data value in register P7 using the psString attribute syntax instead, pushing the new data onto the program stack.

SEE ALSO

pal_commands(5), pal_registers(5), pal_indices(5), attr_direct(5), attr_load(5), attr_xcopy(5), attr_export(5), reg_copy(5), ps_attributes(5),
PROSE Assembly Language at prose.sourceforge.net.

AUTHOR

Copyright (c) 2002-2018 Mark R. Bannister <cambridge@users.sourceforge.net>.

This is free software and can be downloaded from prose.sourceforge.net; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


PAL 1.0 attr_def (5) 25 January 2018
Generated by manServer 1.07 from man5/attr_def.5 using man macros.