Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
common.h File Reference
#include <stdio.h>
#include <sys/types.h>
#include <math.h>
#include "sysdeps.h"
+ Include dependency graph for common.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _List
 
struct  Buffer
 
struct  ListHead
 
struct  Dstring
 

Macros

#define strchr   index
 
#define strrchr   rindex
 
#define memcpy(a, b, n)   bcopy((b), (a), (n))
 
#define memmove(a, b, n)   bcopy((b), (a), (n))
 
#define memzero(a, n)   bzero((a), (n))
 
#define LIST(x)   ((List *)(x))
 
#define MDVI_EMPTY_LIST_HEAD   {NULL, NULL, 0}
 
#define fgetbyte(p)   ((unsigned)getc(p))
 
#define fuget4(p)   fugetn((p), 4)
 
#define fuget3(p)   fugetn((p), 3)
 
#define fuget2(p)   fugetn((p), 2)
 
#define fuget1(p)   fgetbyte(p)
 
#define fsget4(p)   fsgetn((p), 4)
 
#define fsget3(p)   fsgetn((p), 3)
 
#define fsget2(p)   fsgetn((p), 2)
 
#define fsget1(p)   fsgetn((p), 1)
 
#define MUGETN(p, n)   ((p) += (n), mugetn((p)-(n), (n)))
 
#define MSGETN(p, n)   ((p) += (n), msgetn((p)-(n), (n)))
 
#define muget4(p)   MUGETN((p), 4)
 
#define muget3(p)   MUGETN((p), 3)
 
#define muget2(p)   MUGETN((p), 2)
 
#define muget1(p)   MUGETN((p), 1)
 
#define msget4(p)   MSGETN((p), 4)
 
#define msget3(p)   MSGETN((p), 3)
 
#define msget2(p)   MSGETN((p), 2)
 
#define msget1(p)   MSGETN((p), 1)
 
#define ROUND(x, y)   (((x) + (y) - 1) / (y))
 
#define FROUND(x)   (int)((x) + 0.5)
 
#define SFROUND(x)   (int)((x) >= 0 ? floor((x) + 0.5) : ceil((x) + 0.5))
 
#define Max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define Min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define HALFWORD(a, b)   ((((a) << 8) & 0xf) | (b))
 
#define FULLWORD(a, b, c, d)
 
#define SWAPINT(a, b)   do { int _s = a; a = b; b = _s; } while(0)
 
#define STREQ(a, b)   (strcmp((a), (b)) == 0)
 
#define STRNEQ(a, b, n)   (strncmp((a), (b), (n)) == 0)
 
#define STRCEQ(a, b)   (strcasecmp((a), (b)) == 0)
 
#define STRNCEQ(a, b, n)   (strncasecmp((a), (b), (n)) == 0)
 
#define LOG_NONE   -1
 
#define LOG_INFO   0
 
#define LOG_WARN   1
 
#define LOG_ERROR   2
 
#define LOG_DEBUG   3
 
#define DBG_OPCODE   (1 << 0)
 
#define DBG_FONTS   (1 << 1)
 
#define DBG_FILES   (1 << 2)
 
#define DBG_DVI   (1 << 3)
 
#define DBG_PARAMS   (1 << 4)
 
#define DBG_SPECIAL   (1 << 5)
 
#define DBG_DEVICE   (1 << 6)
 
#define DBG_GLYPHS   (1 << 7)
 
#define DBG_BITMAPS   (1 << 8)
 
#define DBG_PATHS   (1 << 9)
 
#define DBG_SEARCH   (1 << 10)
 
#define DBG_VARS   (1 << 11)
 
#define DBG_BITMAP_OPS   (1 << 12)
 
#define DBG_BITMAP_DATA   (1 << 13)
 
#define DBG_TYPE1   (1 << 14)
 
#define DBG_TT   (1 << 15)
 
#define DBG_FT2   (1 << 16)
 
#define DBG_FMAP   (1 << 17)
 
#define DBG_SILENT   (1 << 31)
 
#define DEBUGGING(x)   (_mdvi_debug_mask & DBG_##x)
 
#define DEBUG(x)   __debug x
 
#define ASSERT(x)
 
#define ASSERT_VALUE(x, y)
 
#define set_debug_mask(m)   (_mdvi_debug_mask = (Uint32)(m))
 
#define add_debug_mask(m)   (_mdvi_debug_mask |= (Uint32)(m))
 
#define get_debug_mask()   _mdvi_debug_mask
 
#define xalloc(t)   (t *)mdvi_malloc(sizeof(t))
 
#define xnalloc(t, n)   (t *)mdvi_calloc((n), sizeof(t))
 
#define xresize(p, t, n)   (t *)mdvi_realloc((p), (n) * sizeof(t))
 
#define dstring_length(d)   ((d)->length)
 
#define dstring_strcat(d, s)   dstring_append((d), (s), -1)
 
#define LIST_FOREACH(ptr, type, list)   for(ptr = (type *)(list)->head; ptr; ptr = (ptr)->next)
 
#define Size(x)   (sizeof(x) / sizeof((x)[0]))
 
#define B0(x)   ((x) & 0xff)
 
#define B1(x)   B0((x) >> 8)
 
#define B2(x)   B0((x) >> 16)
 
#define B3(x)   B0((x) >> 24)
 
#define __tfm_mul(z, t)   (((((B0(t) * (z)) >> 8) + (B1(t) * (z))) >> 8) + B2(t) * (z))
 
#define TFMSCALE(z, t, a, b)
 
#define TFMPREPARE(x, z, a, b)
 

Typedefs

typedef struct _List List
 

Functions

Ulong fugetn __PROTO ((FILE *, size_t))
 
Ulong mugetn __PROTO ((const Uchar *, size_t))
 
char *read_string __PROTO ((FILE *, int, char *, size_t))
 
size_t read_bcpl __PROTO ((FILE *, char *, size_t, size_t))
 
char *read_alloc_bcpl __PROTO ((FILE *, size_t, size_t *))
 
void mdvi_message __PROTO ((const char *,...))
 
int unit2pix __PROTO ((int, const char *))
 
double unit2pix_factor __PROTO ((const char *))
 
void __debug __PROTO ((int, const char *,...))
 
void mdvi_free __PROTO ((void *))
 
void *mdvi_malloc __PROTO ((size_t))
 
void *mdvi_realloc __PROTO ((void *, size_t))
 
void *mdvi_calloc __PROTO ((size_t, size_t))
 
char *mdvi_strncpy __PROTO ((char *, const char *, size_t))
 
char *mdvi_strndup __PROTO ((const char *, size_t))
 
void *mdvi_memdup __PROTO ((const void *, size_t))
 
char *mdvi_strrstr __PROTO ((const char *, const char *))
 
char *xstradd __PROTO ((char *, size_t *, size_t, const char *, size_t))
 
Ulong get_mtime __PROTO ((int))
 
void listh_init __PROTO ((ListHead *))
 
void listh_prepend __PROTO ((ListHead *, List *))
 
void listh_add_before __PROTO ((ListHead *, List *, List *))
 
void listh_concat __PROTO ((ListHead *, ListHead *))
 
void buff_init __PROTO ((Buffer *))
 
size_t buff_add __PROTO ((Buffer *, const char *, size_t))
 
char *buff_gets __PROTO ((Buffer *, size_t *))
 
char *getword __PROTO ((char *, const char *, char **))
 
void dstring_init __PROTO ((Dstring *))
 
int dstring_new __PROTO ((Dstring *, const char *, int))
 
int dstring_copy __PROTO ((Dstring *, int, const char *, int))
 
char *dgets __PROTO ((Dstring *, FILE *))
 

Variables

char * program_name
 
Uint32 _mdvi_debug_mask
 

Macro Definition Documentation

#define __tfm_mul (   z,
 
)    (((((B0(t) * (z)) >> 8) + (B1(t) * (z))) >> 8) + B2(t) * (z))

Definition at line 273 of file common.h.

#define add_debug_mask (   m)    (_mdvi_debug_mask |= (Uint32)(m))

Definition at line 200 of file common.h.

#define ASSERT (   x)
Value:
do { \
if(!(x)) mdvi_crash("%s:%d: Assertion %s failed\n", \
__FILE__, __LINE__, #x); \
} while(0)

Definition at line 184 of file common.h.

#define ASSERT_VALUE (   x,
 
)
Value:
do { \
if((x) != (y)) \
mdvi_crash("%s:%d: Assertion failed (%d = %s != %s)\n", \
__FILE__, __LINE__, (x), #x, #x); \
} while(0)

Definition at line 188 of file common.h.

#define B0 (   x)    ((x) & 0xff)

Definition at line 269 of file common.h.

#define B1 (   x)    B0((x) >> 8)

Definition at line 270 of file common.h.

#define B2 (   x)    B0((x) >> 16)

Definition at line 271 of file common.h.

#define B3 (   x)    B0((x) >> 24)

Definition at line 272 of file common.h.

#define DBG_BITMAP_DATA   (1 << 13)

Definition at line 166 of file common.h.

#define DBG_BITMAP_OPS   (1 << 12)

Definition at line 165 of file common.h.

#define DBG_BITMAPS   (1 << 8)

Definition at line 161 of file common.h.

#define DBG_DEVICE   (1 << 6)

Definition at line 159 of file common.h.

#define DBG_DVI   (1 << 3)

Definition at line 156 of file common.h.

#define DBG_FILES   (1 << 2)

Definition at line 155 of file common.h.

#define DBG_FMAP   (1 << 17)

Definition at line 170 of file common.h.

#define DBG_FONTS   (1 << 1)

Definition at line 154 of file common.h.

#define DBG_FT2   (1 << 16)

Definition at line 169 of file common.h.

#define DBG_GLYPHS   (1 << 7)

Definition at line 160 of file common.h.

#define DBG_OPCODE   (1 << 0)

Definition at line 153 of file common.h.

#define DBG_PARAMS   (1 << 4)

Definition at line 157 of file common.h.

#define DBG_PATHS   (1 << 9)

Definition at line 162 of file common.h.

#define DBG_SEARCH   (1 << 10)

Definition at line 163 of file common.h.

#define DBG_SILENT   (1 << 31)

Definition at line 172 of file common.h.

#define DBG_SPECIAL   (1 << 5)

Definition at line 158 of file common.h.

#define DBG_TT   (1 << 15)

Definition at line 168 of file common.h.

#define DBG_TYPE1   (1 << 14)

Definition at line 167 of file common.h.

#define DBG_VARS   (1 << 11)

Definition at line 164 of file common.h.

#define DEBUG (   x)    __debug x

Definition at line 183 of file common.h.

#define DEBUGGING (   x)    (_mdvi_debug_mask & DBG_##x)

Definition at line 177 of file common.h.

#define dstring_length (   d)    ((d)->length)

Definition at line 250 of file common.h.

#define dstring_strcat (   d,
 
)    dstring_append((d), (s), -1)

Definition at line 251 of file common.h.

#define fgetbyte (   p)    ((unsigned)getc(p))

Definition at line 75 of file common.h.

#define FROUND (   x)    (int)((x) + 0.5)

Definition at line 107 of file common.h.

#define fsget1 (   p)    fsgetn((p), 1)

Definition at line 92 of file common.h.

#define fsget2 (   p)    fsgetn((p), 2)

Definition at line 91 of file common.h.

#define fsget3 (   p)    fsgetn((p), 3)

Definition at line 90 of file common.h.

#define fsget4 (   p)    fsgetn((p), 4)

Definition at line 89 of file common.h.

#define fuget1 (   p)    fgetbyte(p)

Definition at line 88 of file common.h.

#define fuget2 (   p)    fugetn((p), 2)

Definition at line 87 of file common.h.

#define fuget3 (   p)    fugetn((p), 3)

Definition at line 86 of file common.h.

#define fuget4 (   p)    fugetn((p), 4)

Definition at line 85 of file common.h.

#define FULLWORD (   a,
  b,
  c,
 
)
Value:
((((Int8)(a) << 24) & 0xff000000) | \
(((Uint8)(b) << 16) & 0x00ff0000) | \
(((Uint8)(c) << 8) & 0x0000ff00) | \
((Uint8)(d) & 0xff))

Definition at line 115 of file common.h.

#define get_debug_mask ( )    _mdvi_debug_mask

Definition at line 201 of file common.h.

#define HALFWORD (   a,
 
)    ((((a) << 8) & 0xf) | (b))

Definition at line 114 of file common.h.

#define LIST (   x)    ((List *)(x))

Definition at line 52 of file common.h.

#define LIST_FOREACH (   ptr,
  type,
  list 
)    for(ptr = (type *)(list)->head; ptr; ptr = (ptr)->next)

Definition at line 263 of file common.h.

#define LOG_DEBUG   3

Definition at line 151 of file common.h.

#define LOG_ERROR   2

Definition at line 150 of file common.h.

#define LOG_INFO   0

Definition at line 148 of file common.h.

#define LOG_NONE   -1

Definition at line 147 of file common.h.

#define LOG_WARN   1

Definition at line 149 of file common.h.

#define Max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 110 of file common.h.

#define MDVI_EMPTY_LIST_HEAD   {NULL, NULL, 0}

Definition at line 65 of file common.h.

#define memcpy (   a,
  b,
 
)    bcopy((b), (a), (n))

Definition at line 37 of file common.h.

#define memmove (   a,
  b,
 
)    bcopy((b), (a), (n))

Definition at line 38 of file common.h.

#define memzero (   a,
 
)    bzero((a), (n))

Definition at line 45 of file common.h.

#define Min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 111 of file common.h.

#define msget1 (   p)    MSGETN((p), 1)

Definition at line 104 of file common.h.

#define msget2 (   p)    MSGETN((p), 2)

Definition at line 103 of file common.h.

#define msget3 (   p)    MSGETN((p), 3)

Definition at line 102 of file common.h.

#define msget4 (   p)    MSGETN((p), 4)

Definition at line 101 of file common.h.

#define MSGETN (   p,
 
)    ((p) += (n), msgetn((p)-(n), (n)))

Definition at line 96 of file common.h.

#define muget1 (   p)    MUGETN((p), 1)

Definition at line 100 of file common.h.

#define muget2 (   p)    MUGETN((p), 2)

Definition at line 99 of file common.h.

#define muget3 (   p)    MUGETN((p), 3)

Definition at line 98 of file common.h.

#define muget4 (   p)    MUGETN((p), 4)

Definition at line 97 of file common.h.

#define MUGETN (   p,
 
)    ((p) += (n), mugetn((p)-(n), (n)))

Definition at line 95 of file common.h.

#define ROUND (   x,
 
)    (((x) + (y) - 1) / (y))

Definition at line 106 of file common.h.

#define set_debug_mask (   m)    (_mdvi_debug_mask = (Uint32)(m))

Definition at line 199 of file common.h.

#define SFROUND (   x)    (int)((x) >= 0 ? floor((x) + 0.5) : ceil((x) + 0.5))

Definition at line 108 of file common.h.

#define Size (   x)    (sizeof(x) / sizeof((x)[0]))

Definition at line 266 of file common.h.

#define STRCEQ (   a,
 
)    (strcasecmp((a), (b)) == 0)

Definition at line 130 of file common.h.

#define strchr   index

Definition at line 33 of file common.h.

#define STREQ (   a,
 
)    (strcmp((a), (b)) == 0)

Definition at line 128 of file common.h.

#define STRNCEQ (   a,
  b,
 
)    (strncasecmp((a), (b), (n)) == 0)

Definition at line 131 of file common.h.

#define STRNEQ (   a,
  b,
 
)    (strncmp((a), (b), (n)) == 0)

Definition at line 129 of file common.h.

#define strrchr   rindex

Definition at line 34 of file common.h.

#define SWAPINT (   a,
 
)    do { int _s = a; a = b; b = _s; } while(0)

Definition at line 125 of file common.h.

#define TFMPREPARE (   x,
  z,
  a,
 
)
Value:
do { \
a = 16; z = (x); \
while(z > 040000000L) { z >>= 1; a <<= 1; } \
b = 256 / a; a *= z; \
} while(0)

Definition at line 279 of file common.h.

#define TFMSCALE (   z,
  t,
  a,
 
)
Value:
((B3(t) == 255) ? \
__tfm_mul((z), (t)) / (b) - (a) : \
__tfm_mul((z), (t)) / (b))

Definition at line 275 of file common.h.

#define xalloc (   t)    (t *)mdvi_malloc(sizeof(t))

Definition at line 217 of file common.h.

#define xnalloc (   t,
 
)    (t *)mdvi_calloc((n), sizeof(t))

Definition at line 218 of file common.h.

#define xresize (   p,
  t,
 
)    (t *)mdvi_realloc((p), (n) * sizeof(t))

Definition at line 219 of file common.h.

Typedef Documentation

typedef struct _List List

Function Documentation

Ulong fugetn __PROTO ( (FILE *, size_t)  )
Ulong mugetn __PROTO ( (const Uchar *, size_t)  )
char* read_string __PROTO ( (FILE *, int, char *, size_t)  )
size_t read_bcpl __PROTO ( (FILE *, char *, size_t, size_t)  )
char* read_alloc_bcpl __PROTO ( (FILE *, size_t, size_t *)  )
void mdvi_message __PROTO ( (const char *,...)  )
int unit2pix __PROTO ( (int, const char *)  )
double unit2pix_factor __PROTO ( (const char *)  )
void __debug __PROTO ( (int, const char *,...)  )
void mdvi_free __PROTO ( (void *)  )
void* mdvi_malloc __PROTO ( (size_t)  )
void* mdvi_realloc __PROTO ( (void *, size_t)  )
void* mdvi_calloc __PROTO ( (size_t, size_t)  )
char* mdvi_strncpy __PROTO ( (char *, const char *, size_t)  )
char* mdvi_strndup __PROTO ( (const char *, size_t)  )
void* mdvi_memdup __PROTO ( (const void *, size_t)  )
char* mdvi_strrstr __PROTO ( (const char *, const char *)  )
char* xstradd __PROTO ( (char *, size_t *, size_t, const char *, size_t)  )
Ulong get_mtime __PROTO ( (int)  )
void listh_init __PROTO ( (ListHead *)  )
void listh_prepend __PROTO ( (ListHead *, List *)  )
void listh_add_before __PROTO ( (ListHead *, List *, List *)  )
void listh_concat __PROTO ( (ListHead *, ListHead *)  )
void buff_init __PROTO ( (Buffer *)  )
size_t buff_add __PROTO ( (Buffer *, const char *, size_t)  )
char* buff_gets __PROTO ( (Buffer *, size_t *)  )
char* getword __PROTO ( (char *, const char *, char **)  )
void dstring_init __PROTO ( (Dstring *)  )
int dstring_new __PROTO ( (Dstring *, const char *, int)  )
int dstring_copy __PROTO ( (Dstring *, int, const char *, int)  )
char* dgets __PROTO ( (Dstring *, FILE *)  )

Variable Documentation

Uint32 _mdvi_debug_mask

Definition at line 94 of file util.c.

char* program_name

Definition at line 29 of file pagesel.c.