# #include "termflag.h"

This page has information from files termflag.h and termflag.c.

## Contents

- Public Routines
- Public Definitions
- Introduction

## Public Routines in File termflag.c

#### Index

claim_term_flag | release_term_flag | term_flag_clear_recursively |
copy_term_with_flag | term_flag | term_flag_set |
copy_term_with_flags | term_flag_clear | term_flags |

#### Details

    int claim_term_flag();

This routine returns an available flag number for marking terms. If the use will be temporary, make sure to call release_term_flag() when you are finished using the marks. A fatal error occurs if no more flags are available.

    Term copy_term_with_flag(Term t, int flag);

This routine copies a term, including one specified flag of the term and its subterms. Any other flags or extra fields are not copied.

    Term copy_term_with_flags(Term t);

This routine copies a term, including all of the flags of the term and its subterms. Any other extra fields are not copied.

    void release_term_flag(int bit);

This routine frees a flag number for future use.

    BOOL term_flag(Term t, int flag);

This function gets the value of a flag on a term. The flag argument is a small integer in the range [0 ... n-1], where n is the number of bits available for flags. If n is out of range, FALSE is returned.

    void term_flag_clear(Term t, int flag);

This routine clears a flag on a term. The flag argument is a small integer in the range [0 .. n-1], where n is the number of bits available for flags. If n is out of range, none of the flags will change.

    void term_flag_clear_recursively(Term t, int flag);

    void term_flag_set(Term t, int flag);

This routine sets a flag on a term. The flag argument is a small integer in the range [0 .. n-1], where n is the number of bits available for flags. If n is out of range, none of the flags will change.

Term flags are stored as bits in the field private_flags. (Look at the definition of Term to find out big private_flags is.) If you need more flags, you can simply change the type of private_flags to unsigned short (usually 16 bits) or unsigned int (usually 32 bits). It is your responsibility to make sure that all of the flags you use are in range.

    int term_flags();

This routine returns the number of bits available for term flags. The value should always be at least 8. If the value is n, you can use flags numbered [0 ... n-1].

## Public Definitions in File termflag.h

    #define TP_BIT(bits, flag)     (bits & flag)

## Introduction