Back to index

tetex-bin  3.0
Classes | Functions | Variables
ppagelist.c File Reference
#include "dvipng.h"

Go to the source code of this file.

Classes

struct  pp_list

Functions

void FirstPage (int32_t page, bool data)
void LastPage (int32_t page, bool data)
void Reverse (bool new)
bool InPageList (int32_t i)
struct page_listNextPPage (void *dvi, struct page_list *page)
void ListPage (int32_t pslow, int32_t pshigh)
bool ParsePages (char *s)
void ClearPpList (void)

Variables

static int32_t first = PAGE_FIRSTPAGE
static int32_t last = PAGE_LASTPAGE
static bool abspage = false
static bool reverse = false
bool no_ppage = true
struct pp_listppages

Class Documentation

struct pp_list

Definition at line 88 of file ppagelist.c.

Collaboration diagram for pp_list:
Class Members
struct pp_list * next
int32_t ps_high
int32_t ps_low

Function Documentation

Definition at line 171 of file ppagelist.c.

{
  register struct pp_list *pl = ppages;

  while (pl) {
    ppages=ppages->next;
    free(pl);
    pl = ppages;
  }
  first=PAGE_FIRSTPAGE;
  last=PAGE_LASTPAGE;
  abspage = false;
  no_ppage=true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirstPage ( int32_t  page,
bool  data 
)

Definition at line 40 of file ppagelist.c.

Definition at line 99 of file ppagelist.c.

{
  register struct pp_list *pl = ppages;

  while (pl) {
    if ( i >= pl -> ps_low && i <= pl -> ps_high)
      return(true);         /* success */
    pl = pl -> next;
  }
  return(false);
}

Here is the caller graph for this function:

void LastPage ( int32_t  page,
bool  data 
)

Definition at line 45 of file ppagelist.c.

{
  last=page;
  abspage |= data;
}
void ListPage ( int32_t  pslow,
int32_t  pshigh 
)

Definition at line 111 of file ppagelist.c.

{
  register struct pp_list   *pl;

  /* Some added code, we want to reuse the list */
  no_ppage=false;
  pl = ppages;
  while (pl != NULL && pl->ps_low <= pl->ps_high)
    pl = pl->next;
  if (pl == NULL) {
    if ((pl = (struct pp_list *)malloc(sizeof(struct pp_list)))
       ==NULL) 
      Fatal("cannot allocate memory for page queue");
    pl -> next = ppages;
    ppages = pl;
  }
  pl -> ps_low = pslow;
  pl -> ps_high = pshigh;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct page_list* NextPPage ( void dvi,
struct page_list page 
) [read]

Definition at line 62 of file ppagelist.c.

{
  if (! reverse) { /*********** normal order */
    if (page == NULL) { /* first call: find first page */ 
      if (no_ppage)
       return(NULL);
      page=FindPage(dvi,first,abspage);
    } else              /* later calls: count up, except "last" page */ 
      page=(last==page->count[abspage ? 0 : 10]) ? NULL : NextPage(dvi,page);
    /* seek for pages in pagelist */ 
    while (page!=NULL && ! InPageList(page->count[0]))
      page=(last==page->count[abspage ? 0 : 10]) ? NULL : NextPage(dvi,page);
  } else { /******************** reverse order */
    if (page == NULL) { /* first call: find "last" page */ 
      if (no_ppage)
       return(NULL);
      page=FindPage(dvi,last,abspage);
    } else              /* later calls: count down, except "first" page */
      page=(first==page->count[abspage ? 0 : 10]) ? NULL : PrevPage(dvi,page);
    /* seek for pages in pagelist */ 
    while (page!=NULL && ! InPageList(page->count[0])) 
      page=(first==page->count[abspage ? 0 : 10]) ? NULL : PrevPage(dvi,page);
  }
  return(page);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ParsePages ( char *  s)

Definition at line 134 of file ppagelist.c.

{
  char *c;           /* conversion start */
  long int ps_low = PAGE_MINPAGE, ps_high = PAGE_MAXPAGE;

  while (*s==' ' || *s=='\t') s++;
  while (*s!='\0') {
    if (*s=='-' || *s==':') { /* range with no starting value */
      ps_low = PAGE_MINPAGE;
      c=s+1;
      ps_high = strtol(c,&s,10);
      if (c==s) ps_high=PAGE_MAXPAGE; /* no number */
      while (*s==' ' || *s=='\t') s++;
      if (*s=='-' || *s==':') { /* Oh, range with negative starting value */
       ps_low = -ps_high;
       c=s+1;
       ps_high = strtol(c,&s,10);
       if (c==s) ps_high=PAGE_MAXPAGE; /* no number */
      }
    } else { /* range with starting value, or singleton */
      c=s;
      ps_low = ps_high = strtol(c,&s,10);
      if (c==s) 
       return(true);
      if (*s=='-' || *s==':') { /* range */
       c=s+1;
       ps_high = strtol(c,&s,10);
       if (c==s) ps_high=PAGE_MAXPAGE; /* no number */
      }
    }
    ListPage(ps_low, ps_high);
    while (*s==' ' || *s=='\t' || *s==',') s++;
  }
  return(false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Reverse ( bool  new)

Definition at line 50 of file ppagelist.c.

{
  reverse=new;
}

Variable Documentation

bool abspage = false [static]

Definition at line 31 of file ppagelist.c.

Definition at line 30 of file ppagelist.c.

Definition at line 30 of file ppagelist.c.

Definition at line 32 of file ppagelist.c.

struct pp_list * ppages
bool reverse = false [static]

Definition at line 31 of file ppagelist.c.