fuzzball-muck / fuzzball

Ongoing development of the Fuzzball MUCK server software and associated functionality.
Other
46 stars 26 forks source link

Add {flag?} MPI function #718

Closed wyld-sw closed 8 months ago

wyld-sw commented 8 months ago

This adds an MPI counterpart to the FLAG? MUF primitive. The check logic has been extracted into its own function.

Functionality

Both MPI and MUF versions check a single flag, which can be a prefix of a flag alias (regardless of object type). The check can also include any number of "!" characters on the left-hand side of the string for alternating negation.

This may be the first object-facing MPI function I've contributed, so let me know if I missed something there.

Consistency

This check now recognizes BOUND, HIDE, SETUID, and XPRESS as flag aliases. SET also was changed to recognize them.

Minor change

The code for FLAG? currently:

This seems inconsistent, as the first two are similar conditions to the third. I've changed the third case to return 0 (with a bonus of returning 0 more quickly in the first case). I can see a corner case where one would want to abort when checking for "!", but it doesn't seem that compelling. Feel free to disagree, and I can change it to pass the error condition back to {flag?} and FLAG?.