# 1 "charmap.c" # 1 "" # 1 "" # 1 "charmap.c" # 34 "charmap.c" # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h" 1 3 4 # 35 "charmap.c" 2 __asm__(".ident\t\"" "$FreeBSD: head/usr.bin/localedef/charmap.c 290511 2015-11-07 20:29:23Z bapt $" "\""); # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 1 3 4 # 53 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 3 4 # 1 "/usr/include/machine/endian.h" 1 3 4 # 1 "/usr/include/x86/endian.h" 1 3 4 # 37 "/usr/include/x86/endian.h" 3 4 # 1 "/usr/include/sys/_types.h" 1 3 4 # 33 "/usr/include/sys/_types.h" 3 4 # 1 "/usr/include/machine/_types.h" 1 3 4 # 1 "/usr/include/x86/_types.h" 1 3 4 # 51 "/usr/include/x86/_types.h" 3 4 typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; typedef long __int64_t; typedef unsigned long __uint64_t; # 77 "/usr/include/x86/_types.h" 3 4 typedef __int32_t __clock_t; typedef __int64_t __critical_t; typedef double __double_t; typedef float __float_t; typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; # 91 "/usr/include/x86/_types.h" 3 4 typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef __int64_t __ptrdiff_t; typedef __int64_t __register_t; typedef __int64_t __segsz_t; typedef __uint64_t __size_t; typedef __int64_t __ssize_t; typedef __int64_t __time_t; typedef __uint64_t __uintfptr_t; typedef __uint64_t __uintptr_t; # 119 "/usr/include/x86/_types.h" 3 4 typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; typedef __uint64_t __vm_size_t; # 143 "/usr/include/x86/_types.h" 3 4 typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_pindex_t; typedef int ___wchar_t; # 154 "/usr/include/x86/_types.h" 3 4 typedef __builtin_va_list __va_list; # 169 "/usr/include/x86/_types.h" 3 4 typedef __va_list __gnuc_va_list; # 6 "/usr/include/machine/_types.h" 2 3 4 # 34 "/usr/include/sys/_types.h" 2 3 4 typedef __int32_t __blksize_t; typedef __int64_t __blkcnt_t; typedef __int32_t __clockid_t; typedef __uint32_t __fflags_t; typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; typedef __uint32_t __ino_t; typedef long __key_t; typedef __int32_t __lwpid_t; typedef __uint16_t __mode_t; typedef int __accmode_t; typedef int __nl_item; typedef __uint16_t __nlink_t; typedef __int64_t __off_t; typedef __int32_t __pid_t; typedef __int64_t __rlim_t; typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; typedef struct __timer *__timer_t; typedef struct __mq *__mqd_t; typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; typedef int __cpuwhich_t; typedef int __cpulevel_t; typedef int __cpusetid_t; # 87 "/usr/include/sys/_types.h" 3 4 typedef int __ct_rune_t; typedef __ct_rune_t __rune_t; typedef __ct_rune_t __wint_t; typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; typedef __uint32_t __dev_t; typedef __uint32_t __fixpt_t; typedef union { char __mbstate8[128]; __int64_t _mbstateL; } __mbstate_t; # 38 "/usr/include/x86/endian.h" 2 3 4 # 91 "/usr/include/x86/endian.h" 3 4 static __inline __uint16_t __bswap16_var(__uint16_t _x) { return ((__uint16_t)((_x) << 8 | (_x) >> 8)); } static __inline __uint32_t __bswap32_var(__uint32_t _x) { __asm("bswap %0" : "+r" (_x)); return (_x); } static __inline __uint64_t __bswap64_var(__uint64_t _x) { __asm("bswap %0" : "+r" (_x)); return (_x); } # 6 "/usr/include/machine/endian.h" 2 3 4 # 54 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 2 3 4 # 1 "/usr/include/sys/_pthreadtypes.h" 1 3 4 # 44 "/usr/include/sys/_pthreadtypes.h" 3 4 struct pthread; struct pthread_attr; struct pthread_cond; struct pthread_cond_attr; struct pthread_mutex; struct pthread_mutex_attr; struct pthread_once; struct pthread_rwlock; struct pthread_rwlockattr; struct pthread_barrier; struct pthread_barrier_attr; struct pthread_spinlock; # 65 "/usr/include/sys/_pthreadtypes.h" 3 4 typedef struct pthread *pthread_t; typedef struct pthread_attr *pthread_attr_t; typedef struct pthread_mutex *pthread_mutex_t; typedef struct pthread_mutex_attr *pthread_mutexattr_t; typedef struct pthread_cond *pthread_cond_t; typedef struct pthread_cond_attr *pthread_condattr_t; typedef int pthread_key_t; typedef struct pthread_once pthread_once_t; typedef struct pthread_rwlock *pthread_rwlock_t; typedef struct pthread_rwlockattr *pthread_rwlockattr_t; typedef struct pthread_barrier *pthread_barrier_t; typedef struct pthread_barrierattr *pthread_barrierattr_t; typedef struct pthread_spinlock *pthread_spinlock_t; typedef void *pthread_addr_t; typedef void *(*pthread_startroutine_t)(void *); struct pthread_once { int state; pthread_mutex_t mutex; }; # 57 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 2 3 4 typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short ushort; typedef unsigned int uint; # 1 "/usr/include/sys/_stdint.h" 1 3 4 # 34 "/usr/include/sys/_stdint.h" 3 4 typedef __int8_t int8_t; typedef __int16_t int16_t; typedef __int32_t int32_t; typedef __int64_t int64_t; typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; typedef __intmax_t intmax_t; typedef __uintmax_t uintmax_t; # 73 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 2 3 4 typedef __uint8_t u_int8_t; typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; typedef __uint64_t u_quad_t; typedef __int64_t quad_t; typedef quad_t * qaddr_t; typedef char * caddr_t; typedef const char * c_caddr_t; typedef __blksize_t blksize_t; typedef __cpuwhich_t cpuwhich_t; typedef __cpulevel_t cpulevel_t; typedef __cpusetid_t cpusetid_t; typedef __blkcnt_t blkcnt_t; typedef __clock_t clock_t; typedef __clockid_t clockid_t; typedef __critical_t critical_t; typedef __int64_t daddr_t; typedef __dev_t dev_t; typedef __fflags_t fflags_t; typedef __fixpt_t fixpt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; typedef __gid_t gid_t; typedef __uint32_t in_addr_t; typedef __uint16_t in_port_t; typedef __id_t id_t; typedef __ino_t ino_t; typedef __key_t key_t; typedef __lwpid_t lwpid_t; typedef __mode_t mode_t; typedef __accmode_t accmode_t; typedef __nlink_t nlink_t; typedef __off_t off_t; typedef __pid_t pid_t; typedef __register_t register_t; typedef __rlim_t rlim_t; typedef __int64_t sbintime_t; typedef __segsz_t segsz_t; typedef long unsigned int size_t; typedef __ssize_t ssize_t; typedef __suseconds_t suseconds_t; typedef __time_t time_t; typedef __timer_t timer_t; typedef __mqd_t mqd_t; typedef __u_register_t u_register_t; typedef __uid_t uid_t; typedef __useconds_t useconds_t; typedef unsigned long cap_ioctl_t; struct cap_rights; typedef struct cap_rights cap_rights_t; typedef __vm_offset_t vm_offset_t; typedef __vm_ooffset_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; typedef __vm_pindex_t vm_pindex_t; typedef __vm_size_t vm_size_t; # 308 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 3 4 # 1 "/usr/include/sys/select.h" 1 3 4 # 38 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/_sigset.h" 1 3 4 # 51 "/usr/include/sys/_sigset.h" 3 4 typedef struct __sigset { __uint32_t __bits[4]; } __sigset_t; # 39 "/usr/include/sys/select.h" 2 3 4 # 1 "/usr/include/sys/_timeval.h" 1 3 4 # 47 "/usr/include/sys/_timeval.h" 3 4 struct timeval { time_t tv_sec; suseconds_t tv_usec; }; # 40 "/usr/include/sys/select.h" 2 3 4 # 1 "/usr/include/sys/timespec.h" 1 3 4 # 38 "/usr/include/sys/timespec.h" 3 4 # 1 "/usr/include/sys/_timespec.h" 1 3 4 # 44 "/usr/include/sys/_timespec.h" 3 4 struct timespec { time_t tv_sec; long tv_nsec; }; # 39 "/usr/include/sys/timespec.h" 2 3 4 # 58 "/usr/include/sys/timespec.h" 3 4 struct itimerspec { struct timespec it_interval; struct timespec it_value; }; # 41 "/usr/include/sys/select.h" 2 3 4 typedef unsigned long __fd_mask; typedef __fd_mask fd_mask; typedef __sigset_t sigset_t; # 71 "/usr/include/sys/select.h" 3 4 typedef struct fd_set { __fd_mask __fds_bits[(((1024) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8)))]; } fd_set; # 97 "/usr/include/sys/select.h" 3 4 int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *); int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); # 309 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 2 3 4 # 321 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 3 4 static __inline __uint16_t __bitcount16(__uint16_t _x) { _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f; _x = (_x + (_x >> 8)) & 0x00ff; return (_x); } static __inline __uint32_t __bitcount32(__uint32_t _x) { _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)) & 0x000000ff; return (_x); } static __inline __uint64_t __bitcount64(__uint64_t _x) { _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)); _x = (_x + (_x >> 32)) & 0x000000ff; return (_x); } # 387 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h" 3 4 int ftruncate(int, off_t); off_t lseek(int, off_t, int); void * mmap(void *, size_t, int, int, int, off_t); int truncate(const char *, off_t); # 38 "charmap.c" 2 # 1 "/usr/include/sys/tree.h" 1 3 4 # 39 "charmap.c" 2 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 1 3 4 # 14 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdarg.h" 1 3 4 # 15 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 2 3 4 # 54 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 # 1 "/usr/include/sys/_null.h" 1 3 4 # 55 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 2 3 4 typedef __off_t fpos_t; # 77 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 typedef __va_list __not_va_list__; # 91 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 struct __sbuf { unsigned char *_base; int _size; }; # 124 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 struct __sFILE { unsigned char *_p; int _r; int _w; short _flags; short _file; struct __sbuf _bf; int _lbfsize; void *_cookie; int (*_close)(void *); int (*_read)(void *, char *, int); fpos_t (*_seek)(void *, fpos_t, int); int (*_write)(void *, const char *, int); struct __sbuf _ub; unsigned char *_up; int _ur; unsigned char _ubuf[3]; unsigned char _nbuf[1]; struct __sbuf _lb; int _blksize; fpos_t _offset; struct pthread_mutex *_fl_mutex; struct pthread *_fl_owner; int _fl_count; int _orientation; __mbstate_t _mbstate; }; typedef struct __sFILE FILE; extern FILE *__stdinp; extern FILE *__stdoutp; extern FILE *__stderrp; # 241 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 void clearerr(FILE *); int fclose(FILE *); int feof(FILE *); int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * , fpos_t * ); char *fgets(char * , int, FILE * ); FILE *fopen(const char * , const char * ); int fprintf(FILE * , const char * , ...); int fputc(int, FILE *); int fputs(const char * , FILE * ); size_t fread(void * , size_t, size_t, FILE * ); FILE *freopen(const char * , const char * , FILE * ); int fscanf(FILE * , const char * , ...); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); size_t fwrite(const void * , size_t, size_t, FILE * ); int getc(FILE *); int getchar(void); char *gets(char *); void perror(const char *); int printf(const char * , ...); int putc(int, FILE *); int putchar(int); int puts(const char *); int remove(const char *); int rename(const char *, const char *); void rewind(FILE *); int scanf(const char * , ...); void setbuf(FILE * , char * ); int setvbuf(FILE * , char * , int, size_t); int sprintf(char * , const char * , ...); int sscanf(const char * , const char * , ...); FILE *tmpfile(void); char *tmpnam(char *); int ungetc(int, FILE *); int vfprintf(FILE * , const char * , __gnuc_va_list); int vprintf(const char * , __gnuc_va_list); int vsprintf(char * , const char * , __gnuc_va_list); int snprintf(char * , size_t, const char * , ...) __attribute__((__format__ (__printf__, 3, 4))); int vfscanf(FILE * , const char * , __gnuc_va_list) __attribute__((__format__ (__scanf__, 2, 0))); int vscanf(const char * , __gnuc_va_list) __attribute__((__format__ (__scanf__, 1, 0))); int vsnprintf(char * , size_t, const char * , __gnuc_va_list) __attribute__((__format__ (__printf__, 3, 0))); int vsscanf(const char * , const char * , __gnuc_va_list) __attribute__((__format__ (__scanf__, 2, 0))); # 314 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); int pclose(FILE *); FILE *popen(const char *, const char *); int ftrylockfile(FILE *); void flockfile(FILE *); void funlockfile(FILE *); int getc_unlocked(FILE *); int getchar_unlocked(void); int putc_unlocked(int, FILE *); int putchar_unlocked(int); void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); int fileno_unlocked(FILE *); int fseeko(FILE *, __off_t, int); __off_t ftello(FILE *); int getw(FILE *); int putw(int, FILE *); char *tempnam(const char *, const char *); FILE *fmemopen(void * , size_t, const char * ); ssize_t getdelim(char ** , size_t * , int, FILE * ); FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * , __gnuc_va_list); # 410 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 int asprintf(char **, const char *, ...) __attribute__((__format__ (__printf__, 2, 3))); char *ctermid_r(char *); void fcloseall(void); int fdclose(FILE *, int *); char *fgetln(FILE *, size_t *); const char *fmtcheck(const char *, const char *) __attribute__((__format_arg__ (2))); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __gnuc_va_list) __attribute__((__format__ (__printf__, 2, 0))); extern const int sys_nerr; extern const char * const sys_errlist[]; FILE *funopen(const void *, int (*)(void *, char *, int), int (*)(void *, const char *, int), fpos_t (*)(void *, fpos_t, int), int (*)(void *)); # 465 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 int __srget(FILE *); int __swbuf(int, FILE *); static __inline int __sputc(int _c, FILE *_p) { if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else return (__swbuf(_c, _p)); } # 494 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 extern int __isthreaded; # 537 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h" 3 4 # 41 "charmap.c" 2 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h" 1 3 4 # 51 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h" 3 4 typedef __rune_t rune_t; # 69 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h" 3 4 typedef int wchar_t; typedef struct { int quot; int rem; } div_t; typedef struct { long quot; long rem; } ldiv_t; extern int __mb_cur_max; extern int ___mb_cur_max(void); __attribute__((__noreturn__)) void abort(void); int abs(int) __attribute__((__const__)); int atexit(void (*)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(1))) __attribute__((__alloc_size__(2))); div_t div(int, int) __attribute__((__const__)); __attribute__((__noreturn__)) void exit(int); void free(void *); char *getenv(const char *); long labs(long) __attribute__((__const__)); ldiv_t ldiv(long, long) __attribute__((__const__)); void *malloc(size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(1))); int mblen(const char *, size_t); size_t mbstowcs(wchar_t * , const char * , size_t); int mbtowc(wchar_t * , const char * , size_t); void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); int rand(void); void *realloc(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2))); void srand(unsigned); double strtod(const char * , char ** ); float strtof(const char * , char ** ); long strtol(const char * , char ** , int); long double strtold(const char * , char ** ); unsigned long strtoul(const char * , char ** , int); int system(const char *); int wctomb(char *, wchar_t); size_t wcstombs(char * , const wchar_t * , size_t); # 148 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h" 3 4 typedef struct { long long quot; long long rem; } lldiv_t; long long atoll(const char *); long long llabs(long long) __attribute__((__const__)); lldiv_t lldiv(long long, long long) __attribute__((__const__)); long long strtoll(const char * , char ** , int); unsigned long long strtoull(const char * , char ** , int); __attribute__((__noreturn__)) void _Exit(int); void * aligned_alloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__alloc_size__(2))); int at_quick_exit(void (*)(void)); __attribute__((__noreturn__)) void quick_exit(int); char *realpath(const char * , char * ); int rand_r(unsigned *); int posix_memalign(void **, size_t, size_t) __attribute__((__nonnull__(1))) __attribute__((__alloc_size__(3))); int setenv(const char *, const char *, int); int unsetenv(const char *); int getsubopt(char **, char *const *, char **); char *mkdtemp(char *); int mkstemp(char *); # 218 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h" 3 4 long a64l(const char *); double drand48(void); double erand48(unsigned short[3]); int grantpt(int); char *initstate(unsigned long , char *, long); long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); char *mktemp(char *); long mrand48(void); long nrand48(unsigned short[3]); int posix_openpt(int); char *ptsname(int); int putenv(char *); long random(void); unsigned short *seed48(unsigned short[3]); int setkey(const char *); char *setstate( char *); void srand48(long); void srandom(unsigned long); int unlockpt(int); extern const char *malloc_conf; extern void (*malloc_message)(void *, const char *); # 272 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h" 3 4 void abort2(const char *, int, void **) __attribute__((__noreturn__)); __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *, int); void arc4random_buf(void *, size_t); void arc4random_stir(void); __uint32_t arc4random_uniform(__uint32_t); char *getbsize(int *, long *); char *cgetcap(char *, const char *, int); int cgetclose(void); int cgetent(char **, char **, const char *); int cgetfirst(char **, char **); int cgetmatch(const char *, const char *); int cgetnext(char **, char **); int cgetnum(char *, const char *, long *); int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); int daemon(int, int); char *devname(__dev_t, __mode_t); char *devname_r(__dev_t, __mode_t, char *, int); char *fdevname(int); char *fdevname_r(int, char *, int); int getloadavg(double [], int); const char * getprogname(void); int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); int mkostemp(char *, int); int mkostemps(char *, int, int); void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); void *reallocarray(void *, size_t, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2))) __attribute__((__alloc_size__(3))); void *reallocf(void *, size_t) __attribute__((__alloc_size__(2))); int rpmatch(const char *); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); void sranddev(void); void srandomdev(void); long long strtonum(const char *, long long, long long, const char **); __int64_t strtoq(const char *, char **, int); __uint64_t strtouq(const char *, char **, int); extern char *suboptarg; # 42 "charmap.c" 2 # 1 "/usr/include/string.h" 1 3 4 # 45 "/usr/include/string.h" 3 4 # 1 "/usr/include/strings.h" 1 3 4 # 40 "/usr/include/strings.h" 3 4 int bcmp(const void *, const void *, size_t) __attribute__((__pure__)); void bcopy(const void *, void *, size_t); void bzero(void *, size_t); void explicit_bzero(void *, size_t); int ffs(int) __attribute__((__const__)); int ffsl(long) __attribute__((__const__)); int ffsll(long long) __attribute__((__const__)); int fls(int) __attribute__((__const__)); int flsl(long) __attribute__((__const__)); int flsll(long long) __attribute__((__const__)); char *index(const char *, int) __attribute__((__pure__)); char *rindex(const char *, int) __attribute__((__pure__)); int strcasecmp(const char *, const char *) __attribute__((__pure__)); int strncasecmp(const char *, const char *, size_t) __attribute__((__pure__)); # 1 "/usr/include/xlocale/_strings.h" 1 3 4 # 31 "/usr/include/xlocale/_strings.h" 3 4 typedef struct _xlocale *locale_t; # 46 "/usr/include/xlocale/_strings.h" 3 4 int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); # 68 "/usr/include/strings.h" 2 3 4 # 46 "/usr/include/string.h" 2 3 4 void *memccpy(void * , const void * , int, size_t); void *memchr(const void *, int, size_t) __attribute__((__pure__)); void *memrchr(const void *, int, size_t) __attribute__((__pure__)); int memcmp(const void *, const void *, size_t) __attribute__((__pure__)); void *memcpy(void * , const void * , size_t); void *memmem(const void *, size_t, const void *, size_t) __attribute__((__pure__)); void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); char *stpcpy(char * , const char * ); char *stpncpy(char * , const char * , size_t); char *strcasestr(const char *, const char *) __attribute__((__pure__)); char *strcat(char * , const char * ); char *strchr(const char *, int) __attribute__((__pure__)); char *strchrnul(const char*, int) __attribute__((__pure__)); int strcmp(const char *, const char *) __attribute__((__pure__)); int strcoll(const char *, const char *); char *strcpy(char * , const char * ); size_t strcspn(const char *, const char *) __attribute__((__pure__)); char *strdup(const char *) __attribute__((__malloc__)); char *strerror(int); int strerror_r(int, char *, size_t); size_t strlcat(char * , const char * , size_t); size_t strlcpy(char * , const char * , size_t); size_t strlen(const char *) __attribute__((__pure__)); void strmode(int, char *); char *strncat(char * , const char * , size_t); int strncmp(const char *, const char *, size_t) __attribute__((__pure__)); char *strncpy(char * , const char * , size_t); char *strndup(const char *, size_t) __attribute__((__malloc__)); size_t strnlen(const char *, size_t) __attribute__((__pure__)); char *strnstr(const char *, const char *, size_t) __attribute__((__pure__)); char *strpbrk(const char *, const char *) __attribute__((__pure__)); char *strrchr(const char *, int) __attribute__((__pure__)); char *strsep(char **, const char *); char *strsignal(int); size_t strspn(const char *, const char *) __attribute__((__pure__)); char *strstr(const char *, const char *) __attribute__((__pure__)); char *strtok(char * , const char * ); char *strtok_r(char *, const char *, char **); size_t strxfrm(char * , const char * , size_t); # 134 "/usr/include/string.h" 3 4 void swab(const void * , void * , ssize_t); # 1 "/usr/include/xlocale/_string.h" 1 3 4 # 46 "/usr/include/xlocale/_string.h" 3 4 int strcoll_l(const char *, const char *, locale_t); size_t strxfrm_l(char *, const char *, size_t, locale_t); # 141 "/usr/include/string.h" 2 3 4 # 43 "charmap.c" 2 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/limits.h" 1 3 4 # 34 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/limits.h" 3 4 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/syslimits.h" 1 3 4 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/limits.h" 1 3 4 # 168 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/limits.h" 3 4 # 1 "/usr/include/limits.h" 1 3 4 # 138 "/usr/include/limits.h" 3 4 # 1 "/usr/include/sys/limits.h" 1 3 4 # 36 "/usr/include/sys/limits.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 # 1 "/usr/include/x86/_limits.h" 1 3 4 # 6 "/usr/include/machine/_limits.h" 2 3 4 # 37 "/usr/include/sys/limits.h" 2 3 4 # 139 "/usr/include/limits.h" 2 3 4 # 1 "/usr/include/sys/syslimits.h" 1 3 4 # 142 "/usr/include/limits.h" 2 3 4 # 169 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/limits.h" 2 3 4 # 8 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/syslimits.h" 2 3 4 # 35 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/limits.h" 2 3 4 # 44 "charmap.c" 2 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 1 3 4 # 47 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 3 4 # 1 "/usr/include/sys/unistd.h" 1 3 4 # 48 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 2 3 4 # 332 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 3 4 void _exit(int) __attribute__((__noreturn__)); int access(const char *, int); unsigned int alarm(unsigned int); int chdir(const char *); int chown(const char *, uid_t, gid_t); int close(int); void closefrom(int); int dup(int); int dup2(int, int); int execl(const char *, const char *, ...) __attribute__((__sentinel__)); int execle(const char *, const char *, ...); int execlp(const char *, const char *, ...) __attribute__((__sentinel__)); int execv(const char *, char * const *); int execve(const char *, char * const *, char * const *); int execvp(const char *, char * const *); pid_t fork(void); long fpathconf(int, int); char *getcwd(char *, size_t); gid_t getegid(void); uid_t geteuid(void); gid_t getgid(void); int getgroups(int, gid_t []); char *getlogin(void); pid_t getpgrp(void); pid_t getpid(void); pid_t getppid(void); uid_t getuid(void); int isatty(int); int link(const char *, const char *); long pathconf(const char *, int); int pause(void); int pipe(int *); ssize_t read(int, void *, size_t); int rmdir(const char *); int setgid(gid_t); int setpgid(pid_t, pid_t); pid_t setsid(void); int setuid(uid_t); unsigned int sleep(unsigned int); long sysconf(int); pid_t tcgetpgrp(int); int tcsetpgrp(int, pid_t); char *ttyname(int); int ttyname_r(int, char *, size_t); int unlink(const char *); ssize_t write(int, const void *, size_t); size_t confstr(int, char *, size_t); int getopt(int, char * const [], const char *); extern char *optarg; extern int optind, opterr, optopt; int fsync(int); # 412 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 3 4 int getlogin_r(char *, int); int fchown(int, uid_t, gid_t); ssize_t readlink(const char * , char * , size_t); int gethostname(char *, size_t); int setegid(gid_t); int seteuid(uid_t); int getsid(pid_t _pid); int fchdir(int); int getpgid(pid_t _pid); int lchown(const char *, uid_t, gid_t); ssize_t pread(int, void *, size_t, off_t); ssize_t pwrite(int, const void *, size_t, off_t); # 443 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 3 4 int faccessat(int, const char *, int, int); int fchownat(int, const char *, uid_t, gid_t, int); int fexecve(int, char *const [], char *const []); int linkat(int, const char *, int, const char *, int); ssize_t readlinkat(int, const char * , char * , size_t); int symlinkat(const char *, int, const char *); int unlinkat(int, const char *, int); # 458 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h" 3 4 int symlink(const char * , const char * ); char *crypt(const char *, const char *); int encrypt(char *, int); long gethostid(void); int lockf(int, int, off_t); int nice(int); int setregid(gid_t, gid_t); int setreuid(uid_t, uid_t); void sync(void); int brk(const void *); int chroot(const char *); int getdtablesize(void); int getpagesize(void) __attribute__((__const__)); char *getpass(const char *); void *sbrk(intptr_t); char *getwd(char *); useconds_t ualarm(useconds_t, useconds_t); int usleep(useconds_t); pid_t vfork(void) __attribute__((__returns_twice__)); struct timeval; int acct(const char *); int async_daemon(void); int check_utility_compat(const char *); const char * crypt_get_format(void); int crypt_set_format(const char *); int des_cipher(const char *, char *, long, int); int des_setkey(const char *key); int dup3(int, int, int); int eaccess(const char *, int); void endusershell(void); int exect(const char *, char * const *, char * const *); int execvP(const char *, const char *, char * const *); int feature_present(const char *); char *fflagstostr(u_long); int getdomainname(char *, int); int getgrouplist(const char *, gid_t, gid_t *, int *); int getloginclass(char *, size_t); mode_t getmode(const void *, mode_t); int getosreldate(void); int getpeereid(int, uid_t *, gid_t *); int getresgid(gid_t *, gid_t *, gid_t *); int getresuid(uid_t *, uid_t *, uid_t *); char *getusershell(void); int initgroups(const char *, gid_t); int iruserok(unsigned long, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); int issetugid(void); void __FreeBSD_libc_enter_restricted_mode(void); long lpathconf(const char *, int); int mknod(const char *, mode_t, dev_t); int mkstemps(char *, int); int nfssvc(int, void *); int nlm_syscall(int, int, int, char **); int pipe2(int *, int); int profil(char *, size_t, vm_offset_t, int); int rcmd(char **, int, const char *, const char *, const char *, int *); int rcmd_af(char **, int, const char *, const char *, const char *, int *, int); int rcmdsh(char **, int, const char *, const char *, const char *, const char *); char *re_comp(const char *); int re_exec(const char *); int reboot(int); int revoke(const char *); pid_t rfork(int); pid_t rfork_thread(int, void *, int (*)(void *), void *); int rresvport(int *); int rresvport_af(int *, int); int ruserok(const char *, int, const char *, const char *); int setdomainname(const char *, int); int setgroups(int, const gid_t *); void sethostid(long); int sethostname(const char *, int); int setlogin(const char *); int setloginclass(const char *); void *setmode(const char *); int setpgrp(pid_t, pid_t); void setproctitle(const char *_fmt, ...) ; int setresgid(gid_t, gid_t, gid_t); int setresuid(uid_t, uid_t, uid_t); int setrgid(gid_t); int setruid(uid_t); void setusershell(void); int strtofflags(char **, u_long *, u_long *); int swapon(const char *); int swapoff(const char *); int syscall(int, ...); off_t __syscall(quad_t, ...); int undelete(const char *); int unwhiteout(const char *); void *valloc(size_t); extern int optreset; # 45 "charmap.c" 2 # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stddef.h" 1 3 4 # 147 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stddef.h" 3 4 typedef long int ptrdiff_t; # 46 "charmap.c" 2 # 1 "localedef.h" 1 # 40 "localedef.h" # 1 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdarg.h" 1 3 4 # 98 "/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdarg.h" 3 4 typedef __gnuc_va_list va_list; # 41 "localedef.h" 2 extern int com_char; extern int esc_char; extern int mb_cur_max; extern int mb_cur_min; extern int last_kw; extern int verbose; extern int yydebug; extern int lineno; extern int undefok; extern int warnok; extern int warnings; int yylex(void); void yyerror(const char *); void errf(const char *, ...); void warn(const char *, ...); int putl_category(const char *, FILE *); int wr_category(void *, size_t, FILE *); FILE *open_category(void); void close_category(FILE *); void copy_category(char *); const char *category_name(void); int get_category(void); int get_symbol(void); int get_escaped(int); int get_wide(void); void reset_scanner(const char *); void scan_to_eol(void); void add_wcs(wchar_t); void add_tok(int); wchar_t *get_wcs(void); void init_charmap(void); void add_charmap(const char *, int); void add_charmap_undefined(char *); void add_charmap_posix(void); void add_charmap_range(char *, char *, int); void add_charmap_char(const char *name, int val); int lookup_charmap(const char *, wchar_t *); int check_charmap_undefined(char *); int check_charmap(wchar_t); typedef struct collelem collelem_t; typedef struct collsym collsym_t; void init_collate(void); void define_collsym(char *); void define_collelem(char *, wchar_t *); void add_order_directive(void); void add_order_bit(int); void dump_collate(void); collsym_t *lookup_collsym(char *); collelem_t *lookup_collelem(char *); void start_order_collelem(collelem_t *); void start_order_undefined(void); void start_order_symbol(char *); void start_order_char(wchar_t); void start_order_ellipsis(void); void end_order_collsym(collsym_t *); void end_order(void); void add_weight(int32_t, int); void add_weights(int32_t *); void add_weight_num(int); void add_order_collelem(collelem_t *); void add_order_collsym(collsym_t *); void add_order_char(wchar_t); void add_order_ignore(void); void add_order_ellipsis(void); void add_order_symbol(char *); void add_order_subst(void); void add_subst_char(wchar_t); void add_subst_collsym(collsym_t *); void add_subst_collelem(collelem_t *); void add_subst_symbol(char *); int32_t get_weight(int32_t, int); wchar_t * wsncpy(wchar_t *, const wchar_t *, size_t); void init_ctype(void); void add_ctype(int); void add_ctype_range(int); void add_width(int, int); void add_width_range(int, int, int); void add_caseconv(int, int); void dump_ctype(void); void init_messages(void); void add_message(wchar_t *); void dump_messages(void); void init_monetary(void); void add_monetary_str(wchar_t *); void add_monetary_num(int); void reset_monetary_group(void); void add_monetary_group(int); void dump_monetary(void); void init_numeric(void); void add_numeric_str(wchar_t *); void reset_numeric_group(void); void add_numeric_group(int); void dump_numeric(void); void init_time(void); void add_time_str(wchar_t *); void reset_time_list(void); void add_time_list(wchar_t *); void check_time_list(void); void dump_time(void); int to_wide(wchar_t *, const char *); int to_mbs(char *, wchar_t); int to_mb(char *, wchar_t); char *to_mb_string(const wchar_t *); void set_wide_encoding(const char *); void werr(const char *, ...); const char *get_wide_encoding(void); int max_wide(void); # 48 "charmap.c" 2 # 1 "parser.h" 1 # 111 "parser.h" typedef union { int num; wchar_t wc; char *token; collsym_t *collsym; collelem_t *collelem; } YYSTYPE; extern YYSTYPE yylval; # 49 "charmap.c" 2 typedef struct charmap { const char *name; wchar_t wc; struct { struct charmap *rbe_left; struct charmap *rbe_right; struct charmap *rbe_parent; int rbe_color; } rb_sym; struct { struct charmap *rbe_left; struct charmap *rbe_right; struct charmap *rbe_parent; int rbe_color; } rb_wc; } charmap_t; static int cmap_compare_sym(const void *n1, const void *n2); static int cmap_compare_wc(const void *n1, const void *n2); static struct cmap_sym { struct charmap *rbh_root; } cmap_sym; static struct cmap_wc { struct charmap *rbh_root; } cmap_wc; __attribute__((__unused__)) static void cmap_sym_RB_INSERT_COLOR(struct cmap_sym *head, struct charmap *elm) { struct charmap *parent, *gparent, *tmp; while ((parent = (elm)->rb_sym.rbe_parent) != ((void *)0) && (parent)->rb_sym.rbe_color == 1) { gparent = (parent)->rb_sym.rbe_parent; if (parent == (gparent)->rb_sym.rbe_left) { tmp = (gparent)->rb_sym.rbe_right; if (tmp && (tmp)->rb_sym.rbe_color == 1) { (tmp)->rb_sym.rbe_color = 0; do { (parent)->rb_sym.rbe_color = 0; (gparent)->rb_sym.rbe_color = 1; } while ( 0); elm = gparent; continue; } if ((parent)->rb_sym.rbe_right == elm) { do { (tmp) = (parent)->rb_sym.rbe_right; if (((parent)->rb_sym.rbe_right = (tmp)->rb_sym.rbe_left) != ((void *)0)) { ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (parent)->rb_sym.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_left = (parent); (parent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); tmp = parent; parent = elm; elm = tmp; } do { (parent)->rb_sym.rbe_color = 0; (gparent)->rb_sym.rbe_color = 1; } while ( 0); do { (tmp) = (gparent)->rb_sym.rbe_left; if (((gparent)->rb_sym.rbe_left = (tmp)->rb_sym.rbe_right) != ((void *)0)) { ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_parent = (gparent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (gparent)->rb_sym.rbe_parent) != ((void *)0)) { if ((gparent) == ((gparent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((gparent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((gparent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_right = (gparent); (gparent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); } else { tmp = (gparent)->rb_sym.rbe_left; if (tmp && (tmp)->rb_sym.rbe_color == 1) { (tmp)->rb_sym.rbe_color = 0; do { (parent)->rb_sym.rbe_color = 0; (gparent)->rb_sym.rbe_color = 1; } while ( 0); elm = gparent; continue; } if ((parent)->rb_sym.rbe_left == elm) { do { (tmp) = (parent)->rb_sym.rbe_left; if (((parent)->rb_sym.rbe_left = (tmp)->rb_sym.rbe_right) != ((void *)0)) { ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (parent)->rb_sym.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_right = (parent); (parent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); tmp = parent; parent = elm; elm = tmp; } do { (parent)->rb_sym.rbe_color = 0; (gparent)->rb_sym.rbe_color = 1; } while ( 0); do { (tmp) = (gparent)->rb_sym.rbe_right; if (((gparent)->rb_sym.rbe_right = (tmp)->rb_sym.rbe_left) != ((void *)0)) { ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_parent = (gparent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (gparent)->rb_sym.rbe_parent) != ((void *)0)) { if ((gparent) == ((gparent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((gparent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((gparent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_left = (gparent); (gparent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); } } (head->rbh_root)->rb_sym.rbe_color = 0; } __attribute__((__unused__)) static void cmap_sym_RB_REMOVE_COLOR(struct cmap_sym *head, struct charmap *parent, struct charmap *elm) { struct charmap *tmp; while ((elm == ((void *)0) || (elm)->rb_sym.rbe_color == 0) && elm != (head)->rbh_root) { if ((parent)->rb_sym.rbe_left == elm) { tmp = (parent)->rb_sym.rbe_right; if ((tmp)->rb_sym.rbe_color == 1) { do { (tmp)->rb_sym.rbe_color = 0; (parent)->rb_sym.rbe_color = 1; } while ( 0); do { (tmp) = (parent)->rb_sym.rbe_right; if (((parent)->rb_sym.rbe_right = (tmp)->rb_sym.rbe_left) != ((void *)0)) { ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (parent)->rb_sym.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_left = (parent); (parent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_sym.rbe_right; } if (((tmp)->rb_sym.rbe_left == ((void *)0) || ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_color == 0) && ((tmp)->rb_sym.rbe_right == ((void *)0) || ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_color == 0)) { (tmp)->rb_sym.rbe_color = 1; elm = parent; parent = (elm)->rb_sym.rbe_parent; } else { if ((tmp)->rb_sym.rbe_right == ((void *)0) || ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_color == 0) { struct charmap *oleft; if ((oleft = (tmp)->rb_sym.rbe_left) != ((void *)0)) (oleft)->rb_sym.rbe_color = 0; (tmp)->rb_sym.rbe_color = 1; do { (oleft) = (tmp)->rb_sym.rbe_left; if (((tmp)->rb_sym.rbe_left = (oleft)->rb_sym.rbe_right) != ((void *)0)) { ((oleft)->rb_sym.rbe_right)->rb_sym.rbe_parent = (tmp); } do {} while (0); if (((oleft)->rb_sym.rbe_parent = (tmp)->rb_sym.rbe_parent) != ((void *)0)) { if ((tmp) == ((tmp)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((tmp)->rb_sym.rbe_parent)->rb_sym.rbe_left = (oleft); else ((tmp)->rb_sym.rbe_parent)->rb_sym.rbe_right = (oleft); } else (head)->rbh_root = (oleft); (oleft)->rb_sym.rbe_right = (tmp); (tmp)->rb_sym.rbe_parent = (oleft); do {} while (0); if (((oleft)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_sym.rbe_right; } (tmp)->rb_sym.rbe_color = (parent)->rb_sym.rbe_color; (parent)->rb_sym.rbe_color = 0; if ((tmp)->rb_sym.rbe_right) ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_color = 0; do { (tmp) = (parent)->rb_sym.rbe_right; if (((parent)->rb_sym.rbe_right = (tmp)->rb_sym.rbe_left) != ((void *)0)) { ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (parent)->rb_sym.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_left = (parent); (parent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); elm = (head)->rbh_root; break; } } else { tmp = (parent)->rb_sym.rbe_left; if ((tmp)->rb_sym.rbe_color == 1) { do { (tmp)->rb_sym.rbe_color = 0; (parent)->rb_sym.rbe_color = 1; } while ( 0); do { (tmp) = (parent)->rb_sym.rbe_left; if (((parent)->rb_sym.rbe_left = (tmp)->rb_sym.rbe_right) != ((void *)0)) { ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (parent)->rb_sym.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_right = (parent); (parent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_sym.rbe_left; } if (((tmp)->rb_sym.rbe_left == ((void *)0) || ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_color == 0) && ((tmp)->rb_sym.rbe_right == ((void *)0) || ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_color == 0)) { (tmp)->rb_sym.rbe_color = 1; elm = parent; parent = (elm)->rb_sym.rbe_parent; } else { if ((tmp)->rb_sym.rbe_left == ((void *)0) || ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_color == 0) { struct charmap *oright; if ((oright = (tmp)->rb_sym.rbe_right) != ((void *)0)) (oright)->rb_sym.rbe_color = 0; (tmp)->rb_sym.rbe_color = 1; do { (oright) = (tmp)->rb_sym.rbe_right; if (((tmp)->rb_sym.rbe_right = (oright)->rb_sym.rbe_left) != ((void *)0)) { ((oright)->rb_sym.rbe_left)->rb_sym.rbe_parent = (tmp); } do {} while (0); if (((oright)->rb_sym.rbe_parent = (tmp)->rb_sym.rbe_parent) != ((void *)0)) { if ((tmp) == ((tmp)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((tmp)->rb_sym.rbe_parent)->rb_sym.rbe_left = (oright); else ((tmp)->rb_sym.rbe_parent)->rb_sym.rbe_right = (oright); } else (head)->rbh_root = (oright); (oright)->rb_sym.rbe_left = (tmp); (tmp)->rb_sym.rbe_parent = (oright); do {} while (0); if (((oright)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_sym.rbe_left; } (tmp)->rb_sym.rbe_color = (parent)->rb_sym.rbe_color; (parent)->rb_sym.rbe_color = 0; if ((tmp)->rb_sym.rbe_left) ((tmp)->rb_sym.rbe_left)->rb_sym.rbe_color = 0; do { (tmp) = (parent)->rb_sym.rbe_left; if (((parent)->rb_sym.rbe_left = (tmp)->rb_sym.rbe_right) != ((void *)0)) { ((tmp)->rb_sym.rbe_right)->rb_sym.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_sym.rbe_parent = (parent)->rb_sym.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left) ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_left = (tmp); else ((parent)->rb_sym.rbe_parent)->rb_sym.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_sym.rbe_right = (parent); (parent)->rb_sym.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_sym.rbe_parent)) do {} while (0); } while ( 0); elm = (head)->rbh_root; break; } } } if (elm) (elm)->rb_sym.rbe_color = 0; } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_INSERT(struct cmap_sym *head, struct charmap *elm) { struct charmap *tmp; struct charmap *parent = ((void *)0); int comp = 0; tmp = (head)->rbh_root; while (tmp) { parent = tmp; comp = (cmap_compare_sym)(elm, parent); if (comp < 0) tmp = (tmp)->rb_sym.rbe_left; else if (comp > 0) tmp = (tmp)->rb_sym.rbe_right; else return (tmp); } do { (elm)->rb_sym.rbe_parent = parent; (elm)->rb_sym.rbe_left = (elm)->rb_sym.rbe_right = ((void *)0); (elm)->rb_sym.rbe_color = 1; } while ( 0); if (parent != ((void *)0)) { if (comp < 0) (parent)->rb_sym.rbe_left = elm; else (parent)->rb_sym.rbe_right = elm; do {} while (0); } else (head)->rbh_root = elm; cmap_sym_RB_INSERT_COLOR(head, elm); return (((void *)0)); } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_REMOVE(struct cmap_sym *head, struct charmap *elm) { struct charmap *child, *parent, *old = elm; int color; if ((elm)->rb_sym.rbe_left == ((void *)0)) child = (elm)->rb_sym.rbe_right; else if ((elm)->rb_sym.rbe_right == ((void *)0)) child = (elm)->rb_sym.rbe_left; else { struct charmap *left; elm = (elm)->rb_sym.rbe_right; while ((left = (elm)->rb_sym.rbe_left) != ((void *)0)) elm = left; child = (elm)->rb_sym.rbe_right; parent = (elm)->rb_sym.rbe_parent; color = (elm)->rb_sym.rbe_color; if (child) (child)->rb_sym.rbe_parent = parent; if (parent) { if ((parent)->rb_sym.rbe_left == elm) (parent)->rb_sym.rbe_left = child; else (parent)->rb_sym.rbe_right = child; do {} while (0); } else (head)->rbh_root = child; if ((elm)->rb_sym.rbe_parent == old) parent = elm; (elm)->rb_sym = (old)->rb_sym; if ((old)->rb_sym.rbe_parent) { if (((old)->rb_sym.rbe_parent)->rb_sym.rbe_left == old) ((old)->rb_sym.rbe_parent)->rb_sym.rbe_left = elm; else ((old)->rb_sym.rbe_parent)->rb_sym.rbe_right = elm; do {} while (0); } else (head)->rbh_root = elm; ((old)->rb_sym.rbe_left)->rb_sym.rbe_parent = elm; if ((old)->rb_sym.rbe_right) ((old)->rb_sym.rbe_right)->rb_sym.rbe_parent = elm; if (parent) { left = parent; do { do {} while (0); } while ((left = (left)->rb_sym.rbe_parent) != ((void *)0)); } goto color; } parent = (elm)->rb_sym.rbe_parent; color = (elm)->rb_sym.rbe_color; if (child) (child)->rb_sym.rbe_parent = parent; if (parent) { if ((parent)->rb_sym.rbe_left == elm) (parent)->rb_sym.rbe_left = child; else (parent)->rb_sym.rbe_right = child; do {} while (0); } else (head)->rbh_root = child; color: if (color == 0) cmap_sym_RB_REMOVE_COLOR(head, parent, child); return (old); } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_FIND(struct cmap_sym *head, struct charmap *elm) { struct charmap *tmp = (head)->rbh_root; int comp; while (tmp) { comp = cmap_compare_sym(elm, tmp); if (comp < 0) tmp = (tmp)->rb_sym.rbe_left; else if (comp > 0) tmp = (tmp)->rb_sym.rbe_right; else return (tmp); } return (((void *)0)); } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_NFIND(struct cmap_sym *head, struct charmap *elm) { struct charmap *tmp = (head)->rbh_root; struct charmap *res = ((void *)0); int comp; while (tmp) { comp = cmap_compare_sym(elm, tmp); if (comp < 0) { res = tmp; tmp = (tmp)->rb_sym.rbe_left; } else if (comp > 0) tmp = (tmp)->rb_sym.rbe_right; else return (tmp); } return (res); } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_NEXT(struct charmap *elm) { if ((elm)->rb_sym.rbe_right) { elm = (elm)->rb_sym.rbe_right; while ((elm)->rb_sym.rbe_left) elm = (elm)->rb_sym.rbe_left; } else { if ((elm)->rb_sym.rbe_parent && (elm == ((elm)->rb_sym.rbe_parent)->rb_sym.rbe_left)) elm = (elm)->rb_sym.rbe_parent; else { while ((elm)->rb_sym.rbe_parent && (elm == ((elm)->rb_sym.rbe_parent)->rb_sym.rbe_right)) elm = (elm)->rb_sym.rbe_parent; elm = (elm)->rb_sym.rbe_parent; } } return (elm); } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_PREV(struct charmap *elm) { if ((elm)->rb_sym.rbe_left) { elm = (elm)->rb_sym.rbe_left; while ((elm)->rb_sym.rbe_right) elm = (elm)->rb_sym.rbe_right; } else { if ((elm)->rb_sym.rbe_parent && (elm == ((elm)->rb_sym.rbe_parent)->rb_sym.rbe_right)) elm = (elm)->rb_sym.rbe_parent; else { while ((elm)->rb_sym.rbe_parent && (elm == ((elm)->rb_sym.rbe_parent)->rb_sym.rbe_left)) elm = (elm)->rb_sym.rbe_parent; elm = (elm)->rb_sym.rbe_parent; } } return (elm); } __attribute__((__unused__)) static struct charmap * cmap_sym_RB_MINMAX(struct cmap_sym *head, int val) { struct charmap *tmp = (head)->rbh_root; struct charmap *parent = ((void *)0); while (tmp) { parent = tmp; if (val < 0) tmp = (tmp)->rb_sym.rbe_left; else tmp = (tmp)->rb_sym.rbe_right; } return (parent); }; __attribute__((__unused__)) static void cmap_wc_RB_INSERT_COLOR(struct cmap_wc *head, struct charmap *elm) { struct charmap *parent, *gparent, *tmp; while ((parent = (elm)->rb_wc.rbe_parent) != ((void *)0) && (parent)->rb_wc.rbe_color == 1) { gparent = (parent)->rb_wc.rbe_parent; if (parent == (gparent)->rb_wc.rbe_left) { tmp = (gparent)->rb_wc.rbe_right; if (tmp && (tmp)->rb_wc.rbe_color == 1) { (tmp)->rb_wc.rbe_color = 0; do { (parent)->rb_wc.rbe_color = 0; (gparent)->rb_wc.rbe_color = 1; } while ( 0); elm = gparent; continue; } if ((parent)->rb_wc.rbe_right == elm) { do { (tmp) = (parent)->rb_wc.rbe_right; if (((parent)->rb_wc.rbe_right = (tmp)->rb_wc.rbe_left) != ((void *)0)) { ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (parent)->rb_wc.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_left = (parent); (parent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); tmp = parent; parent = elm; elm = tmp; } do { (parent)->rb_wc.rbe_color = 0; (gparent)->rb_wc.rbe_color = 1; } while ( 0); do { (tmp) = (gparent)->rb_wc.rbe_left; if (((gparent)->rb_wc.rbe_left = (tmp)->rb_wc.rbe_right) != ((void *)0)) { ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_parent = (gparent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (gparent)->rb_wc.rbe_parent) != ((void *)0)) { if ((gparent) == ((gparent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((gparent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((gparent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_right = (gparent); (gparent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); } else { tmp = (gparent)->rb_wc.rbe_left; if (tmp && (tmp)->rb_wc.rbe_color == 1) { (tmp)->rb_wc.rbe_color = 0; do { (parent)->rb_wc.rbe_color = 0; (gparent)->rb_wc.rbe_color = 1; } while ( 0); elm = gparent; continue; } if ((parent)->rb_wc.rbe_left == elm) { do { (tmp) = (parent)->rb_wc.rbe_left; if (((parent)->rb_wc.rbe_left = (tmp)->rb_wc.rbe_right) != ((void *)0)) { ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (parent)->rb_wc.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_right = (parent); (parent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); tmp = parent; parent = elm; elm = tmp; } do { (parent)->rb_wc.rbe_color = 0; (gparent)->rb_wc.rbe_color = 1; } while ( 0); do { (tmp) = (gparent)->rb_wc.rbe_right; if (((gparent)->rb_wc.rbe_right = (tmp)->rb_wc.rbe_left) != ((void *)0)) { ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_parent = (gparent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (gparent)->rb_wc.rbe_parent) != ((void *)0)) { if ((gparent) == ((gparent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((gparent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((gparent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_left = (gparent); (gparent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); } } (head->rbh_root)->rb_wc.rbe_color = 0; } __attribute__((__unused__)) static void cmap_wc_RB_REMOVE_COLOR(struct cmap_wc *head, struct charmap *parent, struct charmap *elm) { struct charmap *tmp; while ((elm == ((void *)0) || (elm)->rb_wc.rbe_color == 0) && elm != (head)->rbh_root) { if ((parent)->rb_wc.rbe_left == elm) { tmp = (parent)->rb_wc.rbe_right; if ((tmp)->rb_wc.rbe_color == 1) { do { (tmp)->rb_wc.rbe_color = 0; (parent)->rb_wc.rbe_color = 1; } while ( 0); do { (tmp) = (parent)->rb_wc.rbe_right; if (((parent)->rb_wc.rbe_right = (tmp)->rb_wc.rbe_left) != ((void *)0)) { ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (parent)->rb_wc.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_left = (parent); (parent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_wc.rbe_right; } if (((tmp)->rb_wc.rbe_left == ((void *)0) || ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_color == 0) && ((tmp)->rb_wc.rbe_right == ((void *)0) || ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_color == 0)) { (tmp)->rb_wc.rbe_color = 1; elm = parent; parent = (elm)->rb_wc.rbe_parent; } else { if ((tmp)->rb_wc.rbe_right == ((void *)0) || ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_color == 0) { struct charmap *oleft; if ((oleft = (tmp)->rb_wc.rbe_left) != ((void *)0)) (oleft)->rb_wc.rbe_color = 0; (tmp)->rb_wc.rbe_color = 1; do { (oleft) = (tmp)->rb_wc.rbe_left; if (((tmp)->rb_wc.rbe_left = (oleft)->rb_wc.rbe_right) != ((void *)0)) { ((oleft)->rb_wc.rbe_right)->rb_wc.rbe_parent = (tmp); } do {} while (0); if (((oleft)->rb_wc.rbe_parent = (tmp)->rb_wc.rbe_parent) != ((void *)0)) { if ((tmp) == ((tmp)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((tmp)->rb_wc.rbe_parent)->rb_wc.rbe_left = (oleft); else ((tmp)->rb_wc.rbe_parent)->rb_wc.rbe_right = (oleft); } else (head)->rbh_root = (oleft); (oleft)->rb_wc.rbe_right = (tmp); (tmp)->rb_wc.rbe_parent = (oleft); do {} while (0); if (((oleft)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_wc.rbe_right; } (tmp)->rb_wc.rbe_color = (parent)->rb_wc.rbe_color; (parent)->rb_wc.rbe_color = 0; if ((tmp)->rb_wc.rbe_right) ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_color = 0; do { (tmp) = (parent)->rb_wc.rbe_right; if (((parent)->rb_wc.rbe_right = (tmp)->rb_wc.rbe_left) != ((void *)0)) { ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (parent)->rb_wc.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_left = (parent); (parent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); elm = (head)->rbh_root; break; } } else { tmp = (parent)->rb_wc.rbe_left; if ((tmp)->rb_wc.rbe_color == 1) { do { (tmp)->rb_wc.rbe_color = 0; (parent)->rb_wc.rbe_color = 1; } while ( 0); do { (tmp) = (parent)->rb_wc.rbe_left; if (((parent)->rb_wc.rbe_left = (tmp)->rb_wc.rbe_right) != ((void *)0)) { ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (parent)->rb_wc.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_right = (parent); (parent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_wc.rbe_left; } if (((tmp)->rb_wc.rbe_left == ((void *)0) || ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_color == 0) && ((tmp)->rb_wc.rbe_right == ((void *)0) || ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_color == 0)) { (tmp)->rb_wc.rbe_color = 1; elm = parent; parent = (elm)->rb_wc.rbe_parent; } else { if ((tmp)->rb_wc.rbe_left == ((void *)0) || ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_color == 0) { struct charmap *oright; if ((oright = (tmp)->rb_wc.rbe_right) != ((void *)0)) (oright)->rb_wc.rbe_color = 0; (tmp)->rb_wc.rbe_color = 1; do { (oright) = (tmp)->rb_wc.rbe_right; if (((tmp)->rb_wc.rbe_right = (oright)->rb_wc.rbe_left) != ((void *)0)) { ((oright)->rb_wc.rbe_left)->rb_wc.rbe_parent = (tmp); } do {} while (0); if (((oright)->rb_wc.rbe_parent = (tmp)->rb_wc.rbe_parent) != ((void *)0)) { if ((tmp) == ((tmp)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((tmp)->rb_wc.rbe_parent)->rb_wc.rbe_left = (oright); else ((tmp)->rb_wc.rbe_parent)->rb_wc.rbe_right = (oright); } else (head)->rbh_root = (oright); (oright)->rb_wc.rbe_left = (tmp); (tmp)->rb_wc.rbe_parent = (oright); do {} while (0); if (((oright)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); tmp = (parent)->rb_wc.rbe_left; } (tmp)->rb_wc.rbe_color = (parent)->rb_wc.rbe_color; (parent)->rb_wc.rbe_color = 0; if ((tmp)->rb_wc.rbe_left) ((tmp)->rb_wc.rbe_left)->rb_wc.rbe_color = 0; do { (tmp) = (parent)->rb_wc.rbe_left; if (((parent)->rb_wc.rbe_left = (tmp)->rb_wc.rbe_right) != ((void *)0)) { ((tmp)->rb_wc.rbe_right)->rb_wc.rbe_parent = (parent); } do {} while (0); if (((tmp)->rb_wc.rbe_parent = (parent)->rb_wc.rbe_parent) != ((void *)0)) { if ((parent) == ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left) ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_left = (tmp); else ((parent)->rb_wc.rbe_parent)->rb_wc.rbe_right = (tmp); } else (head)->rbh_root = (tmp); (tmp)->rb_wc.rbe_right = (parent); (parent)->rb_wc.rbe_parent = (tmp); do {} while (0); if (((tmp)->rb_wc.rbe_parent)) do {} while (0); } while ( 0); elm = (head)->rbh_root; break; } } } if (elm) (elm)->rb_wc.rbe_color = 0; } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_INSERT(struct cmap_wc *head, struct charmap *elm) { struct charmap *tmp; struct charmap *parent = ((void *)0); int comp = 0; tmp = (head)->rbh_root; while (tmp) { parent = tmp; comp = (cmap_compare_wc)(elm, parent); if (comp < 0) tmp = (tmp)->rb_wc.rbe_left; else if (comp > 0) tmp = (tmp)->rb_wc.rbe_right; else return (tmp); } do { (elm)->rb_wc.rbe_parent = parent; (elm)->rb_wc.rbe_left = (elm)->rb_wc.rbe_right = ((void *)0); (elm)->rb_wc.rbe_color = 1; } while ( 0); if (parent != ((void *)0)) { if (comp < 0) (parent)->rb_wc.rbe_left = elm; else (parent)->rb_wc.rbe_right = elm; do {} while (0); } else (head)->rbh_root = elm; cmap_wc_RB_INSERT_COLOR(head, elm); return (((void *)0)); } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_REMOVE(struct cmap_wc *head, struct charmap *elm) { struct charmap *child, *parent, *old = elm; int color; if ((elm)->rb_wc.rbe_left == ((void *)0)) child = (elm)->rb_wc.rbe_right; else if ((elm)->rb_wc.rbe_right == ((void *)0)) child = (elm)->rb_wc.rbe_left; else { struct charmap *left; elm = (elm)->rb_wc.rbe_right; while ((left = (elm)->rb_wc.rbe_left) != ((void *)0)) elm = left; child = (elm)->rb_wc.rbe_right; parent = (elm)->rb_wc.rbe_parent; color = (elm)->rb_wc.rbe_color; if (child) (child)->rb_wc.rbe_parent = parent; if (parent) { if ((parent)->rb_wc.rbe_left == elm) (parent)->rb_wc.rbe_left = child; else (parent)->rb_wc.rbe_right = child; do {} while (0); } else (head)->rbh_root = child; if ((elm)->rb_wc.rbe_parent == old) parent = elm; (elm)->rb_wc = (old)->rb_wc; if ((old)->rb_wc.rbe_parent) { if (((old)->rb_wc.rbe_parent)->rb_wc.rbe_left == old) ((old)->rb_wc.rbe_parent)->rb_wc.rbe_left = elm; else ((old)->rb_wc.rbe_parent)->rb_wc.rbe_right = elm; do {} while (0); } else (head)->rbh_root = elm; ((old)->rb_wc.rbe_left)->rb_wc.rbe_parent = elm; if ((old)->rb_wc.rbe_right) ((old)->rb_wc.rbe_right)->rb_wc.rbe_parent = elm; if (parent) { left = parent; do { do {} while (0); } while ((left = (left)->rb_wc.rbe_parent) != ((void *)0)); } goto color; } parent = (elm)->rb_wc.rbe_parent; color = (elm)->rb_wc.rbe_color; if (child) (child)->rb_wc.rbe_parent = parent; if (parent) { if ((parent)->rb_wc.rbe_left == elm) (parent)->rb_wc.rbe_left = child; else (parent)->rb_wc.rbe_right = child; do {} while (0); } else (head)->rbh_root = child; color: if (color == 0) cmap_wc_RB_REMOVE_COLOR(head, parent, child); return (old); } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_FIND(struct cmap_wc *head, struct charmap *elm) { struct charmap *tmp = (head)->rbh_root; int comp; while (tmp) { comp = cmap_compare_wc(elm, tmp); if (comp < 0) tmp = (tmp)->rb_wc.rbe_left; else if (comp > 0) tmp = (tmp)->rb_wc.rbe_right; else return (tmp); } return (((void *)0)); } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_NFIND(struct cmap_wc *head, struct charmap *elm) { struct charmap *tmp = (head)->rbh_root; struct charmap *res = ((void *)0); int comp; while (tmp) { comp = cmap_compare_wc(elm, tmp); if (comp < 0) { res = tmp; tmp = (tmp)->rb_wc.rbe_left; } else if (comp > 0) tmp = (tmp)->rb_wc.rbe_right; else return (tmp); } return (res); } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_NEXT(struct charmap *elm) { if ((elm)->rb_wc.rbe_right) { elm = (elm)->rb_wc.rbe_right; while ((elm)->rb_wc.rbe_left) elm = (elm)->rb_wc.rbe_left; } else { if ((elm)->rb_wc.rbe_parent && (elm == ((elm)->rb_wc.rbe_parent)->rb_wc.rbe_left)) elm = (elm)->rb_wc.rbe_parent; else { while ((elm)->rb_wc.rbe_parent && (elm == ((elm)->rb_wc.rbe_parent)->rb_wc.rbe_right)) elm = (elm)->rb_wc.rbe_parent; elm = (elm)->rb_wc.rbe_parent; } } return (elm); } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_PREV(struct charmap *elm) { if ((elm)->rb_wc.rbe_left) { elm = (elm)->rb_wc.rbe_left; while ((elm)->rb_wc.rbe_right) elm = (elm)->rb_wc.rbe_right; } else { if ((elm)->rb_wc.rbe_parent && (elm == ((elm)->rb_wc.rbe_parent)->rb_wc.rbe_right)) elm = (elm)->rb_wc.rbe_parent; else { while ((elm)->rb_wc.rbe_parent && (elm == ((elm)->rb_wc.rbe_parent)->rb_wc.rbe_left)) elm = (elm)->rb_wc.rbe_parent; elm = (elm)->rb_wc.rbe_parent; } } return (elm); } __attribute__((__unused__)) static struct charmap * cmap_wc_RB_MINMAX(struct cmap_wc *head, int val) { struct charmap *tmp = (head)->rbh_root; struct charmap *parent = ((void *)0); while (tmp) { parent = tmp; if (val < 0) tmp = (tmp)->rb_wc.rbe_left; else tmp = (tmp)->rb_wc.rbe_right; } return (parent); }; static const struct { const char *name; int ch; } portable_chars[] = { { "NUL", '\0' }, { "alert", '\a' }, { "backspace", '\b' }, { "tab", '\t' }, { "carriage-return", '\r' }, { "newline", '\n' }, { "vertical-tab", '\v' }, { "form-feed", '\f' }, { "space", ' ' }, { "exclamation-mark", '!' }, { "quotation-mark", '"' }, { "number-sign", '#' }, { "dollar-sign", '$' }, { "percent-sign", '%' }, { "ampersand", '&' }, { "apostrophe", '\'' }, { "left-parenthesis", '(' }, { "right-parenthesis", '(' }, { "asterisk", '*' }, { "plus-sign", '+' }, { "comma", ','}, { "hyphen-minus", '-' }, { "hyphen", '-' }, { "full-stop", '.' }, { "period", '.' }, { "slash", '/' }, { "solidus", '/' }, { "zero", '0' }, { "one", '1' }, { "two", '2' }, { "three", '3' }, { "four", '4' }, { "five", '5' }, { "six", '6' }, { "seven", '7' }, { "eight", '8' }, { "nine", '9' }, { "colon", ':' }, { "semicolon", ';' }, { "less-than-sign", '<' }, { "equals-sign", '=' }, { "greater-than-sign", '>' }, { "question-mark", '?' }, { "commercial-at", '@' }, { "left-square-bracket", '[' }, { "backslash", '\\' }, { "reverse-solidus", '\\' }, { "right-square-bracket", ']' }, { "circumflex", '^' }, { "circumflex-accent", '^' }, { "low-line", '_' }, { "underscore", '_' }, { "grave-accent", '`' }, { "left-brace", '{' }, { "left-curly-bracket", '{' }, { "vertical-line", '|' }, { "right-brace", '}' }, { "right-curly-bracket", '}' }, { "tilde", '~' }, { "A", 'A' }, { "B", 'B' }, { "C", 'C' }, { "D", 'D' }, { "E", 'E' }, { "F", 'F' }, { "G", 'G' }, { "H", 'H' }, { "I", 'I' }, { "J", 'J' }, { "K", 'K' }, { "L", 'L' }, { "M", 'M' }, { "N", 'N' }, { "O", 'O' }, { "P", 'P' }, { "Q", 'Q' }, { "R", 'R' }, { "S", 'S' }, { "T", 'T' }, { "U", 'U' }, { "V", 'V' }, { "W", 'W' }, { "X", 'X' }, { "Y", 'Y' }, { "Z", 'Z' }, { "a", 'a' }, { "b", 'b' }, { "c", 'c' }, { "d", 'd' }, { "e", 'e' }, { "f", 'f' }, { "g", 'g' }, { "h", 'h' }, { "i", 'i' }, { "j", 'j' }, { "k", 'k' }, { "l", 'l' }, { "m", 'm' }, { "n", 'n' }, { "o", 'o' }, { "p", 'p' }, { "q", 'q' }, { "r", 'r' }, { "s", 's' }, { "t", 't' }, { "u", 'u' }, { "v", 'v' }, { "w", 'w' }, { "x", 'x' }, { "y", 'y' }, { "z", 'z' }, { ((void *)0), 0 } }; static int cmap_compare_sym(const void *n1, const void *n2) { const charmap_t *c1 = n1; const charmap_t *c2 = n2; int rv; rv = strcmp(c1->name, c2->name); return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0); } static int cmap_compare_wc(const void *n1, const void *n2) { const charmap_t *c1 = n1; const charmap_t *c2 = n2; return ((c1->wc < c2->wc) ? -1 : (c1->wc > c2->wc) ? 1 : 0); } void init_charmap(void) { do { (&cmap_sym)->rbh_root = ((void *)0); } while ( 0); do { (&cmap_wc)->rbh_root = ((void *)0); } while ( 0); } static void add_charmap_impl(const char *sym, wchar_t wc, int nodups) { charmap_t srch; charmap_t *n = ((void *)0); srch.wc = wc; srch.name = sym; if ((wc != -1) && ((cmap_wc_RB_FIND(&cmap_wc, &srch)) == ((void *)0))) { if ((n = calloc(1, sizeof (*n))) == ((void *)0)) { errf("out of memory"); return; } n->wc = wc; cmap_wc_RB_INSERT(&cmap_wc, n); } if (sym) { if (cmap_sym_RB_FIND(&cmap_sym, &srch) != ((void *)0)) { if (nodups) { errf("duplicate character definition"); } return; } if ((n == ((void *)0)) && ((n = calloc(1, sizeof (*n))) == ((void *)0))) { errf("out of memory"); return; } n->wc = wc; n->name = sym; cmap_sym_RB_INSERT(&cmap_sym, n); } } void add_charmap(const char *sym, int c) { add_charmap_impl(sym, c, 1); } void add_charmap_undefined(char *sym) { charmap_t srch; charmap_t *cm = ((void *)0); srch.name = sym; cm = cmap_sym_RB_FIND(&cmap_sym, &srch); if ((undefok == 0) && ((cm == ((void *)0)) || (cm->wc == -1))) { warn("undefined symbol <%s>", sym); add_charmap_impl(sym, -1, 0); } else { free(sym); } } void add_charmap_range(char *s, char *e, int wc) { int ls, le; int si; int sn, en; int i; static const char *digits = "0123456789"; ls = strlen(s); le = strlen(e); if (((si = strcspn(s, digits)) == 0) || (si == ls) || (strncmp(s, e, si) != 0) || ((int)strspn(s + si, digits) != (ls - si)) || ((int)strspn(e + si, digits) != (le - si)) || ((sn = atoi(s + si)) > ((en = atoi(e + si))))) { errf("malformed charmap range"); return; } s[si] = 0; for (i = sn; i <= en; i++) { char *nn; (void) asprintf(&nn, "%s%0*u", s, ls - si, i); if (nn == ((void *)0)) { errf("out of memory"); return; } add_charmap_impl(nn, wc, 1); wc++; } free(s); free(e); } void add_charmap_char(const char *name, int val) { add_charmap_impl(name, val, 0); } void add_charmap_posix(void) { int i; for (i = 0; portable_chars[i].name; i++) { add_charmap_char(portable_chars[i].name, portable_chars[i].ch); } } int lookup_charmap(const char *sym, wchar_t *wc) { charmap_t srch; charmap_t *n; srch.name = sym; n = cmap_sym_RB_FIND(&cmap_sym, &srch); if (n && n->wc != -1) { if (wc) *wc = n->wc; return (0); } return (-1); } int check_charmap(wchar_t wc) { charmap_t srch; srch.wc = wc; return (cmap_wc_RB_FIND(&cmap_wc, &srch) ? 0 : -1); }