chars.c revision 95c635efb7c3b86efc493e0447eaec7aecca3f0f
/* $Id: chars.c,v 1.52 2011/11/08 00:15:23 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
#include "libmandoc.h"
#define PRINT_HI 126
#define PRINT_LO 32
struct ln {
const char *code;
const char *ascii;
int unicode;
};
#define LINES_MAX 328
#define CHAR_TBL_END };
#include "chars.in"
struct mchars {
};
const char *, size_t);
void
{
}
struct mchars *
mchars_alloc(void)
{
int i, hash;
/*
* Constructs a very basic chaining hashtable. The hash routine
* is simply the integral value of the first character.
* Subsequent entries are chained in the order they're processed.
*/
for (i = 0; i < LINES_MAX; i++) {
continue;
}
/* Scan ahead. */ ;
}
return(tab);
}
int
{
return(-1);
}
char
{
int i;
return('\0');
return(i > 0 && i < 256 && isprint(i) ?
/* LINTED */ i : '\0');
}
int
{
int i;
return('\0');
/* FIXME: make sure we're not in a bogus range. */
return(i > 0x80 && i <= 0x10FFFF ? i : '\0');
}
const char *
{
*rsz = 1;
return(NULL);
}
}
static const struct ln *
{
int hash;
assert(p);
return(NULL);
return(pp);
return(NULL);
}