Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nameprep_template.c File Reference
#include "prtypes.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NAMEPREP_TEMPLATE_INIT
#define compose_sym2(a, b)   compose_sym2X(a, b)
#define compose_sym2X(a, b)   a ## b
#define compose_sym3(a, b, c)   compose_sym3X(a, b, c)
#define compose_sym3X(a, b, c)   a ## b ## c
#define IDX0(type, v)   IDX_0(v, BITS1(type), BITS2(type))
#define IDX1(type, v)   IDX_1(v, BITS1(type), BITS2(type))
#define IDX2(type, v)   IDX_2(v, BITS1(type), BITS2(type))
#define IDX_0(v, bits1, bits2)   ((v) >> ((bits1) + (bits2)))
#define IDX_1(v, bits1, bits2)   (((v) >> (bits2)) & ((1 << (bits1)) - 1))
#define IDX_2(v, bits1, bits2)   ((v) & ((1 << (bits2)) - 1))
#define BITS1(type)   type ## _BITS_1
#define BITS2(type)   type ## _BITS_2
#define IMAP   compose_sym3(nameprep_, VERSION, _map_imap)
#define TABLE   compose_sym3(nameprep_, VERSION, _map_table)
#define DATA   compose_sym3(nameprep_, VERSION, _map_data)
#define IMAP   compose_sym3(nameprep_, VERSION, _prohibited_imap)
#define BITMAP   compose_sym3(nameprep_, VERSION, _prohibited_bitmap)
#define IMAP   compose_sym3(nameprep_, VERSION, _unassigned_imap)
#define BITMAP   compose_sym3(nameprep_, VERSION, _unassigned_bitmap)
#define IMAP   compose_sym3(nameprep_, VERSION, _bidi_imap)
#define TABLE   compose_sym3(nameprep_, VERSION, _bidi_table)
#define DATA   compose_sym3(nameprep_, VERSION, _bidi_data)

Functions

static const char * compose_sym2 (nameprep_map_, VERSION)
static int compose_sym2 (nameprep_prohibited_, VERSION)
static int compose_sym2 (nameprep_unassigned_, VERSION)
static idn_biditype_t compose_sym2 (nameprep_biditype_, VERSION)

Define Documentation

#define BITMAP   compose_sym3(nameprep_, VERSION, _prohibited_bitmap)
#define BITMAP   compose_sym3(nameprep_, VERSION, _unassigned_bitmap)
#define BITS1 (   type)    type ## _BITS_1

Definition at line 72 of file nameprep_template.c.

#define BITS2 (   type)    type ## _BITS_2

Definition at line 73 of file nameprep_template.c.

#define compose_sym2 (   a,
  b 
)    compose_sym2X(a, b)

Definition at line 54 of file nameprep_template.c.

#define compose_sym2X (   a,
  b 
)    a ## b

Definition at line 55 of file nameprep_template.c.

#define compose_sym3 (   a,
  b,
  c 
)    compose_sym3X(a, b, c)

Definition at line 56 of file nameprep_template.c.

#define compose_sym3X (   a,
  b,
  c 
)    a ## b ## c

Definition at line 57 of file nameprep_template.c.

#define DATA   compose_sym3(nameprep_, VERSION, _map_data)
#define DATA   compose_sym3(nameprep_, VERSION, _bidi_data)
#define IDX0 (   type,
  v 
)    IDX_0(v, BITS1(type), BITS2(type))

Definition at line 64 of file nameprep_template.c.

#define IDX1 (   type,
  v 
)    IDX_1(v, BITS1(type), BITS2(type))

Definition at line 65 of file nameprep_template.c.

#define IDX2 (   type,
  v 
)    IDX_2(v, BITS1(type), BITS2(type))

Definition at line 66 of file nameprep_template.c.

#define IDX_0 (   v,
  bits1,
  bits2 
)    ((v) >> ((bits1) + (bits2)))

Definition at line 68 of file nameprep_template.c.

#define IDX_1 (   v,
  bits1,
  bits2 
)    (((v) >> (bits2)) & ((1 << (bits1)) - 1))

Definition at line 69 of file nameprep_template.c.

#define IDX_2 (   v,
  bits1,
  bits2 
)    ((v) & ((1 << (bits2)) - 1))

Definition at line 70 of file nameprep_template.c.

#define IMAP   compose_sym3(nameprep_, VERSION, _map_imap)
#define IMAP   compose_sym3(nameprep_, VERSION, _prohibited_imap)
#define IMAP   compose_sym3(nameprep_, VERSION, _unassigned_imap)
#define IMAP   compose_sym3(nameprep_, VERSION, _bidi_imap)

Definition at line 49 of file nameprep_template.c.

#define TABLE   compose_sym3(nameprep_, VERSION, _map_table)
#define TABLE   compose_sym3(nameprep_, VERSION, _bidi_table)

Function Documentation

static const char* compose_sym2 ( nameprep_map_  ,
VERSION   
) [static]

Definition at line 78 of file nameprep_template.c.

                                                  {
       int idx0 = IDX0(MAP, v);
       int idx1 = IDX1(MAP, v);
       int idx2 = IDX2(MAP, v);
       int offset;

#define IMAP  compose_sym3(nameprep_, VERSION, _map_imap)
#define TABLE compose_sym3(nameprep_, VERSION, _map_table)
#define DATA  compose_sym3(nameprep_, VERSION, _map_data)
       offset = TABLE[IMAP[IMAP[idx0] + idx1]].tbl[idx2];
       if (offset == 0)
              return (NULL);       /* no mapping */
       return (const char *)(DATA + offset);
#undef IMAP
#undef TABLE
#undef DATA
}
static int compose_sym2 ( nameprep_prohibited_  ,
VERSION   
) [static]

Definition at line 97 of file nameprep_template.c.

                                                         {
       int idx0 = IDX0(PROH, v);
       int idx1 = IDX1(PROH, v);
       int idx2 = IDX2(PROH, v);
       const unsigned char *bm;

#define IMAP  compose_sym3(nameprep_, VERSION, _prohibited_imap)
#define BITMAP       compose_sym3(nameprep_, VERSION, _prohibited_bitmap)
       bm = BITMAP[IMAP[IMAP[idx0] + idx1]].bm;
       return (bm[idx2 / 8] & (1 << (idx2 % 8)));
#undef IMAP
#undef BITMAP
}
static int compose_sym2 ( nameprep_unassigned_  ,
VERSION   
) [static]

Definition at line 112 of file nameprep_template.c.

                                                         {
       int idx0 = IDX0(UNAS, v);
       int idx1 = IDX1(UNAS, v);
       int idx2 = IDX2(UNAS, v);
       const unsigned char *bm;

#define IMAP  compose_sym3(nameprep_, VERSION, _unassigned_imap)
#define BITMAP       compose_sym3(nameprep_, VERSION, _unassigned_bitmap)
       bm = BITMAP[IMAP[IMAP[idx0] + idx1]].bm;
       return (bm[idx2 / 8] & (1 << (idx2 % 8)));
#undef IMAP
#undef BITMAP
}
static idn_biditype_t compose_sym2 ( nameprep_biditype_  ,
VERSION   
) [static]

Definition at line 127 of file nameprep_template.c.

                                                       {
       int idx0 = IDX0(BIDI, v);
       int idx1 = IDX1(BIDI, v);
       int idx2 = IDX2(BIDI, v);
       int offset;

#define IMAP  compose_sym3(nameprep_, VERSION, _bidi_imap)
#define TABLE compose_sym3(nameprep_, VERSION, _bidi_table)
#define DATA  compose_sym3(nameprep_, VERSION, _bidi_data)
       offset = TABLE[IMAP[IMAP[idx0] + idx1]].tbl[idx2];
       return DATA[offset];
#undef IMAP
#undef TABLE
#undef DATA
}