1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy is of the CDDL is also available via the Internet
   9  * at http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 /*
  17  * CHARMAP file handling for iconv.
  18  */
  19 
  20 /* Common header files. */
  21 #include <stdio.h>
  22 #include <stdlib.h>
  23 #include <stdarg.h>
  24 #include <sys/types.h>
  25 #include <libintl.h>
  26 
  27 enum cmap_pass {
  28         CMAP_PASS_FROM,
  29         CMAP_PASS_TO };
  30 
  31 extern int com_char;
  32 extern int esc_char;
  33 extern int mb_cur_max;
  34 extern int mb_cur_min;
  35 extern int last_kw;
  36 extern int verbose;
  37 extern int yydebug;
  38 extern int lineno;
  39 extern int debug;
  40 extern int warnings;
  41 extern int cflag;
  42 extern int sflag;
  43 
  44 int yyparse(void);
  45 void yyerror(const char *);
  46 void errf(const char *, ...);
  47 void warn(const char *, ...);
  48 
  49 void reset_scanner(const char *);
  50 void scan_to_eol(void);
  51 
  52 /* charmap.c - CHARMAP handling */
  53 void init_charmap(void);
  54 void add_charmap(char *, char *);
  55 void add_charmap_posix(void);
  56 void add_charmap_range(char *, char *, char *);
  57 
  58 void charmap_init(char *to, char *fr);
  59 size_t cm_iconv(const char **iptr, size_t *ileft, char **optr, size_t *oleft);
  60 void charmap_dump(void);
  61 
  62 #define _(x)    gettext(x)
  63 #define INTERR  errf(_("internal fault (%s:%d)"), __FILE__, __LINE__)