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


Manual Reference Pages  - attr_test (5)

NAME

attr/test - Test attributes

CONTENTS

Synopsis
Description
Error Handling
Examples
See Also
Author

SYNOPSIS

attr/test ![object], attribute, value <, attribute, value ... >

DESCRIPTION

Tests a node on the nexus identified by the object register for a given list of attributes and values. The attribute argument is a register or index containing either the text name of the attribute or a pointer to an attribute definition returned by the attr/load instruction. The value argument is a register or text value to test, or the NULL register to test only for the presence of the attribute regardless of its value.

Each attribute and value pair will result in a new value being written to the SCMP and SFLG registers. If the attribute is assigned to the object with the given value (or with any value if NULL was specified), the result will be PSCMP_EQUAL, otherwise it will be PSCMP_NOTEQUAL.

If value is a raw index (PSUNIT_TYPE_RAWIDX) then the index number will be converted to a byte string representation before the comparison is made. Successive attempts in hexadecimal (prefixed 0x), octal (prefixed 0) and decimal (no prefix) are made to attempt a match. To prevent this type of conversion and comparison, convert raw indices to encoded values first using attr/def.

If value is encoded data (PSUNIT_TYPE_XVALUE) and the data encoding is not of an appropriate syntax for direct comparison with the selected attribute, then it will be re-encoded as a byte string before the comparison is made.

ERROR HANDLING

A runtime error will occur if a register is of the wrong type or if a named attribute or object could not be found.

EXAMPLES

attr/test P0, [author], [Stephen King]
  Tests to see if the object pointed to in P0 has an author attribute with the value "Stephen King". The SCMP register will contain the result of the test and the lowermost bit of the SFLG register will be set accordingly.

SEE ALSO

pal_commands(5), pal_registers(5), pal_indices(5), attr_mvtest(5), attr_load(5), class_test(5), attr_def(5),
PROSE Assembly Language at prose.sourceforge.net.

AUTHOR

Copyright (c) 2002-2009 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_test (5) 25 November 2009
Generated by manServer 1.07 from man5/attr_test.5 using man macros.