Back to index

texmacs  1.0.7.15
Defines | Functions | Variables
unicode.c File Reference
#include <string.h>
#include "system.h"
#include "mem.h"
#include "error.h"
#include "dpxutil.h"
#include "pdfobj.h"
#include "pdfresource.h"
#include "pdfencoding.h"
#include "agl.h"
#include "unicode.h"

Go to the source code of this file.

Defines

#define UC_DEBUG   3
#define UC_DEBUG_STR   "UC"
#define UC_REPLACEMENT_CHAR   0x0000FFFDL
#define UC_SUR_SHIFT   10
#define UC_SUR_MASK   0x3FFUL
#define UC_SUR_LOW_START   0xDC00UL
#define UC_SUR_HIGH_START   0xD800UL

Functions

void UC_set_verbose (void)
int UC_sput_UTF16BE (long ucv, unsigned char **pp, unsigned char *limptr)
int UC_is_valid (long ucv)

Variables

static int __verbose = 0

Define Documentation

#define UC_DEBUG   3

Definition at line 53 of file unicode.c.

#define UC_DEBUG_STR   "UC"

Definition at line 54 of file unicode.c.

#define UC_REPLACEMENT_CHAR   0x0000FFFDL

Definition at line 62 of file unicode.c.

#define UC_SUR_HIGH_START   0xD800UL

Definition at line 67 of file unicode.c.

#define UC_SUR_LOW_START   0xDC00UL

Definition at line 66 of file unicode.c.

#define UC_SUR_MASK   0x3FFUL

Definition at line 65 of file unicode.c.

#define UC_SUR_SHIFT   10

Definition at line 64 of file unicode.c.


Function Documentation

int UC_is_valid ( long  ucv)

Definition at line 107 of file unicode.c.

{
  if (ucv < 0 || (ucv >= 0x0000D800L && ucv <= 0x0000DFFFL))
    return 0;
  return 1;
}

Here is the caller graph for this function:

void UC_set_verbose ( void  )

Definition at line 57 of file unicode.c.

{
  __verbose++;
}

Here is the caller graph for this function:

int UC_sput_UTF16BE ( long  ucv,
unsigned char **  pp,
unsigned char *  limptr 
)

Definition at line 70 of file unicode.c.

{
  int count = 0;
  unsigned char *p = *pp;

  if (ucv >= 0 && ucv <= 0xFFFF) {
    if (p + 2 >= limptr)
      ERROR("Not enough space available...");
    p[0] = (ucv >> 8) & 0xff;
    p[1] = ucv & 0xff;
    count = 2;
  } else if (ucv >= 0x010000L && ucv <= 0x10FFFFL) {
    unsigned short high, low;

    if (p + 4 >= limptr)
      ERROR("Not enough space available...");
    ucv  -= 0x00010000L;
    high = (ucv >> UC_SUR_SHIFT) + UC_SUR_HIGH_START;
    low  = (ucv &  UC_SUR_MASK)  + UC_SUR_LOW_START;
    p[0] = (high >> 8) & 0xff;
    p[1] = (high & 0xff);
    p[2] = (low >> 8) & 0xff;
    p[3] = (low & 0xff);
    count = 4;
  } else {
    if (p + 2 >= limptr)
      ERROR("Not enough space available...");
    p[0] = (UC_REPLACEMENT_CHAR >> 8) & 0xff;
    p[1] = (UC_REPLACEMENT_CHAR & 0xff);
    count = 2;
  }

  *pp += count;
  return count;
}

Here is the caller graph for this function:


Variable Documentation

int __verbose = 0 [static]

Definition at line 51 of file unicode.c.