# #include "lindex.h"

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

## Contents

- Public Routines
- Public Definitions
- Introduction

## Public Routines in File lindex.c

#### Index

fprint_lindex_mem | lindex_destroy | lindex_init | lindex_update_first
lindex_backtrack | lindex_empty | lindex_update | p_lindex_mem

#### Details

    void fprint_lindex_mem(FILE *fp, BOOL heading);

This routine prints (to FILE *fp) memory usage statistics for data types associated with the lindex package. The Boolean argument heading tells whether to print a heading on the table.

    BOOL lindex_backtrack(Lindex idx);

This Boolean function checks if either of the Mindex components (pos, neg) uses backtrack unification.

    void lindex_destroy(Lindex ldx);

This frees all the memory associated with a Lindex. Do not refer to the Lindex after calling this routine.

    BOOL lindex_empty(Lindex idx);

This Boolean routine checks if an Lindex is empty, that is, has no atoms. It must exist (be non-NULL).

    Lindex lindex_init(Mindextype pos_mtype, Uniftype pos_utype, int pos_fpa_depth,
    		   Mindextype neg_mtype, Uniftype neg_utype, int neg_fpa_depth);

This routine allocates and returns a literal index (Lindex), which is a pair of Mindexes, one for positive literals, and one for negative literals. The first three parameters are for the positive literal Mindex, and the second three are for the negative.

- `Mindextype: {LINEAR, FPA, DISCRIM, DISCRIM_BIND}`
- `Uniftype: {ORDINARY_UNIF, BACKTRACK_UNIF}`
- `fpa_depth:` depth of FPA indexing (ignored for other index types).

See the routine mindex_init() for further information.

    void lindex_update(Lindex ldx, Topform c, Indexop op);

This routine indexes (or unindexes) all literals of a clause.

    void lindex_update_first(Lindex ldx, Topform c, Indexop op);

This routine indexes (or unindexes) the first literal of a clause.

    void p_lindex_mem();

This routine prints (to stdout) memory usage statistics for data types associated with the lindex package.

## Public Definitions in File lindex.h

    typedef struct lindex * Lindex;

    struct lindex {
      Mindex pos;   /* index for positive literals */
      Mindex neg;   /* index for negative literals */
      Lindex next;  /* for avail list */
    };

## Introduction

This is a simple package that can be used when you need a pair of indexes (Mindexes), one for positive literals, and one for negative literals. The name Lindex means "literal index".

When you allocate the Lindex (lindex_init()), you specify the parameters as you would for two separate Mindexes. When you insert into or delete from the Lindex, you give a clause, and each literal of the clause is indexed: positive literals go into the positive component of the Lindex, and negative literals go into the negative component.

There are no retrieval operations in this package. Instead, use the retrieval operations from the Mindex package on the appropriate member (positive or negative) of the pair.

See the package "mindex" for information on the initialization parameters and retrieval operations.