PAT_LODPASEQ(3)

NAME

pat_lodpaseq - pattern file compiler

SYNOPSYS

struct paseq *pat_lodpaseq (name, ptseq, maxpat)
char         *name  ;
struct paseq *ptseq ;
unsigned int  maxpat;

PARAMETERS

name
    pattern file's name

ptseq
    pointer on a list of patterns' sequence

maxpat
    number of patterns to be loaded from the file

DESCRIPTION

pat_lodpaseq reads a sequence of patterns from a file named name. (according to MBK_CATA_LIB and VH_PATSFX environment variables). It loads at most maxpat number of patterns from the file and fills the structures.

For the first call, pat_lodpaseq first creates a new sequence (paseq structure) and puts it at the head of the ptseq list. Then, it reads the declaration part and maxpat pattern from the description part. It returns the pointer of the new sequence.

For subsequence calls, pat_lodpaseq first, removes the old patterns from the paseq, then read a new series of patterns.

The pattern file remains openned until the last subsequence is loaded.

Each call of pat_lodpaseq increments the SUBSEQ field of the paseq structure. When the end of file is reached, the ENDFLG of the paseq is set to 'Y'. The pattern file is closed before the function returns.

Setting maxpat to zero makes the whole file be read at once.

RETURN VALUES

pat_lodpaseq returns a NULL pointer if an error occurs when openning the pattern file.

If an error occurs at compil time pat_lodpaseq returns a paseq structure with the ERRFLG set to a non-zero value.

EXAMPLE

#include <pat106.h>
#include <ppt106.h>
struct paseq *paseq_pnt = NULL;
while ((paseq_pnt != NULL) && (paseq_pnt->ENDFLG != 'Y'))
  {
  paseq_pnt = pat_lodpaseq ("my_sequence", paseq_pnt, 1000);
  ...
  }

SEE ALSO

libpat(3), paseq(3), pat_addpaseq(3), pat_savpaseq(3), mbkfopen(3), mbkenv(3)